[PATCH RFC 5/7] fs: Silence bogus copy_to_user() build errors

From: Paul E. McKenney
Date: Sat Apr 14 2012 - 12:21:46 EST


From: "Paul E. McKenney" <paul.mckenney@xxxxxxxxxx>

The copy_to_user() function now does some compile-time buffer-size
checks, but these checks can be fooled by pointers, which always
appear to be 4 or 8 bytes long for 32-bit and 64-bit builds, respectively.
Take care of the warnings in fs/binfmt_misc.c by invoking the underlying
_copy_to_user() function.

Signed-off-by: Paul E. McKenney <paul.mckenney@xxxxxxxxxx>
Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
---
fs/binfmt_misc.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index a9198df..e5ea8c3 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -310,7 +310,7 @@ static Node *create_entry(const char __user *buffer, size_t count)
p = buf = (char *)e + sizeof(Node);

memset(e, 0, sizeof(Node));
- if (copy_from_user(buf, buffer, count))
+ if (_copy_from_user(buf, buffer, count))
goto Efault;

del = *p++; /* delimeter */
@@ -418,7 +418,7 @@ static int parse_command(const char __user *buffer, size_t count)
return 0;
if (count > 3)
return -EINVAL;
- if (copy_from_user(s, buffer, count))
+ if (_copy_from_user(s, buffer, count))
return -EFAULT;
if (s[count-1] == '\n')
count--;
--
1.7.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/