]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] ia32 copy_from_user() fix
authorAndrew Morton <akpm@digeo.com>
Fri, 20 Jun 2003 15:12:27 +0000 (08:12 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Fri, 20 Jun 2003 15:12:27 +0000 (08:12 -0700)
The memset which is performed if access_ok() fails got lost in the
copy_*_user() rework.  Put it back.

Bloats the kernel by 8k :(

Also contains a few related #includes and whitespace fixlets from
Joshua Kwan <joshk@triplehelix.org>

include/asm-h8300/uaccess.h
include/asm-i386/uaccess.h
include/asm-m68knommu/uaccess.h

index 24a0b92b13ee35121ae9ae675b8073ed74857fcc..6996b612f4a013eef1565453bfbb7627ed5ad952 100644 (file)
@@ -6,6 +6,8 @@
  */
 #include <linux/sched.h>
 #include <linux/mm.h>
+#include <linux/string.h>
+
 #include <asm/segment.h>
 
 #define VERIFY_READ    0
@@ -159,7 +161,7 @@ static inline unsigned long
 clear_user(void *to, unsigned long n)
 {
        memset(to, 0, n);
-    return(0);
+       return 0;
 }
 
 #endif /* _H8300_UACCESS_H */
index 07caa21a978c16a848e5d1db3ad7cdb79f79c2b0..b7744806aed68cbf4bcd83071663cd8cadc42857 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/errno.h>
 #include <linux/thread_info.h>
 #include <linux/prefetch.h>
+#include <linux/string.h>
 #include <asm/page.h>
 
 #define VERIFY_READ 0
@@ -494,6 +495,8 @@ copy_from_user(void *to, const void __user *from, unsigned long n)
 {
        if (access_ok(VERIFY_READ, from, n))
                n = __copy_from_user(to, from, n);
+       else
+               memset(to, 0, n);
        return n;
 }
 
index 48a4d74bc226169c89f846df432170ed2a7447c9..6ff1747b02e07d86efb68845382d82789a8aa95d 100644 (file)
@@ -6,6 +6,8 @@
  */
 #include <linux/sched.h>
 #include <linux/mm.h>
+#include <linux/string.h>
+
 #include <asm/segment.h>
 
 #define VERIFY_READ    0
@@ -178,7 +180,7 @@ static inline unsigned long
 clear_user(void *to, unsigned long n)
 {
        memset(to, 0, n);
-    return(0);
+       return 0;
 }
 
 #endif /* _M68KNOMMU_UACCESS_H */