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
-  Lines: 25
-  Date:
Mon Aug 24 12:29:35 1998
-  Orig file: 
v2.1.117/linux/include/asm-ppc/uaccess.h
-  Orig date: 
Mon Jan 12 15:18:13 1998
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