From fe4304baf26e9580ada52e4579b1b7273434d8dd Mon Sep 17 00:00:00 2001 From: Ivan Kokshaysky Date: Mon, 17 Dec 2007 16:19:48 -0800 Subject: alpha: strncpy/strncat fixes First of all, thanks to Bob Tracy and Michael Cree for testing. Especially to Bob, as he has done titanic multi-day git-bisect work that finally helped to reproduce and nail down the bug (http://bugzilla.kernel.org/show_bug.cgi?id=9457). [ev6-]stxncpy.S: it's t12, not t2 register that is supposed to contain the last byte offset upon return. As a result of wrong register use (which was my fault back in 2003, IIRC), under some circumstances extra terminating zero bytes were added to destination string. This particularly led to incorrect DEVPATH strings generated in uevent and therefore to udev problems. strncpy.S: unrelated bug I found while testing the above fix - destination is not properly zero-padded then a byte count exceeds source length. Actually this is addition to strncpy fix from last year. Signed-off-by: Ivan Kokshaysky Cc: Richard Henderson Cc: Bob Tracy Cc: Michael Cree Cc: Kay Sievers Cc: "Rafael J. Wysocki" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/alpha/lib/strncpy.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/alpha/lib/strncpy.S') diff --git a/arch/alpha/lib/strncpy.S b/arch/alpha/lib/strncpy.S index bbdef1be5f95..a46f7f3ad8c7 100644 --- a/arch/alpha/lib/strncpy.S +++ b/arch/alpha/lib/strncpy.S @@ -35,7 +35,7 @@ strncpy: or $3, $24, $3 # clear the bits between the last or $4, $27, $4 # written byte and the last byte in COUNT - andnot $4, $3, $4 + andnot $3, $4, $4 zap $1, $4, $1 stq_u $1, 0($16) -- cgit