tree 5c6d8a4a44acccb6f9685b8d601d4b24357fb130
parent ff0e0ea2f5d36fa90fc2c57fd019102b0a0cfabf
author Al Viro <[EMAIL PROTECTED]> Sun, 03 Apr 2005 09:15:52 +0100
committer Jeff Garzik <[EMAIL PROTECTED]> Sat, 28 May 2005 06:15:13 -0400

[PATCH] ieee80211_module.c::store_debug_level() cleanup

        * trivial __user annotations
        * store_debug_level() sanitized a bit
Signed-off-by: Al Viro <[EMAIL PROTECTED]>

 net/ieee80211/ieee80211_module.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/net/ieee80211/ieee80211_module.c b/net/ieee80211/ieee80211_module.c
--- a/net/ieee80211/ieee80211_module.c
+++ b/net/ieee80211/ieee80211_module.c
@@ -194,17 +194,23 @@ static int show_debug_level(char *page, 
        return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
 }
 
-static int store_debug_level(struct file *file, const char *buffer,
+static int store_debug_level(struct file *file, const char __user *buffer,
                             unsigned long count, void *data)
 {
        char buf[] = "0x00000000";
-       unsigned long len = min(sizeof(buf) - 1, (u32)count);
        char *p = (char *)buf;
        unsigned long val;
 
-       if (copy_from_user(buf, buffer, len))
+       if (count > sizeof(buf) - 1)
+               count = sizeof(buf) - 1;
+
+       if (copy_from_user(buf, buffer, count))
                return count;
-       buf[len] = 0;
+       buf[count] = 0;
+       /*
+        * what a FPOS...  What, sscanf(buf, "%i", &val) would be too
+        * scary?
+        */
        if (p[1] == 'x' || p[1] == 'X' || p[0] == 'x' || p[0] == 'X') {
                p++;
                if (p[0] == 'x' || p[0] == 'X')
@@ -218,7 +224,7 @@ static int store_debug_level(struct file
        else
                ieee80211_debug_level = val;
 
-       return strnlen(buf, count);
+       return strlen(buf);
 }
 
 static int __init ieee80211_init(void)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to