Commit 53f35f47 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ia32 copy_from_user() fix

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>
parent 3119cfff
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
*/ */
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/string.h>
#include <asm/segment.h> #include <asm/segment.h>
#define VERIFY_READ 0 #define VERIFY_READ 0
...@@ -159,7 +161,7 @@ static inline unsigned long ...@@ -159,7 +161,7 @@ static inline unsigned long
clear_user(void *to, unsigned long n) clear_user(void *to, unsigned long n)
{ {
memset(to, 0, n); memset(to, 0, n);
return(0); return 0;
} }
#endif /* _H8300_UACCESS_H */ #endif /* _H8300_UACCESS_H */
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/thread_info.h> #include <linux/thread_info.h>
#include <linux/prefetch.h> #include <linux/prefetch.h>
#include <linux/string.h>
#include <asm/page.h> #include <asm/page.h>
#define VERIFY_READ 0 #define VERIFY_READ 0
...@@ -494,6 +495,8 @@ copy_from_user(void *to, const void __user *from, unsigned long n) ...@@ -494,6 +495,8 @@ copy_from_user(void *to, const void __user *from, unsigned long n)
{ {
if (access_ok(VERIFY_READ, from, n)) if (access_ok(VERIFY_READ, from, n))
n = __copy_from_user(to, from, n); n = __copy_from_user(to, from, n);
else
memset(to, 0, n);
return n; return n;
} }
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
*/ */
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/string.h>
#include <asm/segment.h> #include <asm/segment.h>
#define VERIFY_READ 0 #define VERIFY_READ 0
...@@ -178,7 +180,7 @@ static inline unsigned long ...@@ -178,7 +180,7 @@ static inline unsigned long
clear_user(void *to, unsigned long n) clear_user(void *to, unsigned long n)
{ {
memset(to, 0, n); memset(to, 0, n);
return(0); return 0;
} }
#endif /* _M68KNOMMU_UACCESS_H */ #endif /* _M68KNOMMU_UACCESS_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment