Skip to content

Commit 4d5c34e

Browse files
Ivan KokshayskyLinus Torvalds
authored andcommitted
[PATCH] Alpha: strncpy() fix
As it turned out after recent SCSI changes, strncpy() was broken - it mixed up the return values from __stxncpy() in registers $24 and $27. Thanks to Mathieu Chouquet-Stringer for tracking down the problem and providing an excellent test case. Signed-off-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 454ac77 commit 4d5c34e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎arch/alpha/lib/strncpy.S‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ strncpy:
4343

4444
.align 4
4545
$multiword:
46-
subq $24, 1, $2 # clear the final bits in the prev word
47-
or $2, $24, $2
46+
subq $27, 1, $2 # clear the final bits in the prev word
47+
or $2, $27, $2
4848
zapnot $1, $2, $1
4949
subq $18, 1, $18
5050

@@ -70,8 +70,8 @@ $multiword:
7070
bne $18, 0b
7171

7272
1: ldq_u $1, 0($16) # clear the leading bits in the final word
73-
subq $27, 1, $2
74-
or $2, $27, $2
73+
subq $24, 1, $2
74+
or $2, $24, $2
7575

7676
zap $1, $2, $1
7777
stq_u $1, 0($16)

0 commit comments

Comments
 (0)