Skip to content

Commit

Permalink
[PATCH] Alpha: strncpy() fix
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ivan Kokshaysky authored and Linus Torvalds committed Apr 25, 2006
1 parent 454ac77 commit 4d5c34e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions arch/alpha/lib/strncpy.S
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ strncpy:

.align 4
$multiword:
subq $24, 1, $2 # clear the final bits in the prev word
or $2, $24, $2
subq $27, 1, $2 # clear the final bits in the prev word
or $2, $27, $2
zapnot $1, $2, $1
subq $18, 1, $18

Expand All @@ -70,8 +70,8 @@ $multiword:
bne $18, 0b

1: ldq_u $1, 0($16) # clear the leading bits in the final word
subq $27, 1, $2
or $2, $27, $2
subq $24, 1, $2
or $2, $24, $2

zap $1, $2, $1
stq_u $1, 0($16)
Expand Down

0 comments on commit 4d5c34e

Please sign in to comment.