patch-2.1.118 linux/include/asm-ppc/uaccess.h

Next file: linux/include/asm-sparc/uaccess.h
Previous file: linux/include/asm-m68k/uaccess.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.117/linux/include/asm-ppc/uaccess.h linux/include/asm-ppc/uaccess.h
@@ -211,9 +211,12 @@
 extern inline unsigned long
 copy_from_user(void *to, const void *from, unsigned long n)
 {
-	if (access_ok(VERIFY_READ, from, n))
-		return __copy_tofrom_user(to, from, n);
-	return n? -EFAULT: 0;
+	unsigned long res = n;
+	if (access_ok(VERIFY_READ, from, n)) {
+		 res = __copy_tofrom_user(to, from, n);
+		 if (res) memset((char *)to + n - res, 0, res);
+	}
+	return res;
 }
 
 extern inline unsigned long
@@ -221,7 +224,7 @@
 {
 	if (access_ok(VERIFY_WRITE, to, n))
 		return __copy_tofrom_user(to, from, n);
-	return n? -EFAULT: 0;
+	return n;
 }
 
 #define __copy_from_user(to, from, size) \

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov