wlcore: fix sparse warning
authorEliad Peller <eliad@wizery.com>
Mon, 29 Dec 2014 06:24:02 +0000 (08:24 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 9 Jan 2015 13:47:51 +0000 (15:47 +0200)
Use kstrtoul_from_user() for reading the user value,
and fix the following sparse warning:

drivers/net/wireless/ti/wlcore/debugfs.c:937:15: error: incompatible
types in comparison expression (different type sizes)

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ti/wlcore/debugfs.c

index 0be21f62fcb0eb3a58e7c16886efa8c2bde096cc..68f3bf229b5a5029d57d06638ea5b27144a76e33 100644 (file)
@@ -929,17 +929,10 @@ static ssize_t beacon_filtering_write(struct file *file,
 {
        struct wl1271 *wl = file->private_data;
        struct wl12xx_vif *wlvif;
-       char buf[10];
-       size_t len;
        unsigned long value;
        int ret;
 
-       len = min(count, sizeof(buf) - 1);
-       if (copy_from_user(buf, user_buf, len))
-               return -EFAULT;
-       buf[len] = '\0';
-
-       ret = kstrtoul(buf, 0, &value);
+       ret = kstrtoul_from_user(user_buf, count, 0, &value);
        if (ret < 0) {
                wl1271_warning("illegal value for beacon_filtering!");
                return -EINVAL;