Skip to contentSkip to conversation

x86: Fix miscompile of strncopy_from_user

PATCH New Jan Kiszka 1 participant 1 message Mar 18, 2009

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 x86: Fix miscompile of strncopy_from_user

This merges kernel commit e0a96129db574d6365e3439d16d88517c437ab33 (x86: use early clobbers in usercopy*.c). Without, gcc 4.3 may have let these functions return 0 even if the actual length was > 0.

---

 ksrc/arch/x86/usercopy_32.c |    2 +-
 ksrc/arch/x86/usercopy_64.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
ksrc/arch/x86/usercopy_32.c +1 -1
index 3060cc3..3bcecde 100644
@@ -38,7 +38,7 @@ do {									   \
 		"	.align 4\n"					   \
 		"	.long 0b,3b\n"					   \
 		".previous"						   \
-		: "=d"(res), "=c"(count), "=&a" (__d0), "=&S" (__d1),	   \
+		: "=&d"(res), "=&c"(count), "=&a" (__d0), "=&S" (__d1),	   \
 		  "=&D" (__d2)						   \
 		: "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \
 		: "memory");						   \
ksrc/arch/x86/usercopy_64.c +1 -1
index 1b1da41..5867483 100644
@@ -39,7 +39,7 @@ do {									   \
 		"	.align 8\n"					   \
 		"	.quad 0b,3b\n"					   \
 		".previous"						   \
-		: "=r"(res), "=c"(count), "=&a" (__d0), "=&S" (__d1),	   \
+		: "=&r"(res), "=&c"(count), "=&a" (__d0), "=&S" (__d1),	   \
 		  "=&D" (__d2)						   \
 		: "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \
 		: "memory");						   \