b43legacy: replace simple_strtol() with kstrtoint()
authorchenqiwu <chenqiwu@xiaomi.com>
Wed, 19 Feb 2020 04:15:59 +0000 (12:15 +0800)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 12 Mar 2020 13:40:45 +0000 (15:40 +0200)
The simple_strtol() function is deprecated since it does not
check for the range overflow. Use kstrtoint() instead.

Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/broadcom/b43legacy/sysfs.c

index 9312c1d..eec087c 100644 (file)
 static int get_integer(const char *buf, size_t count)
 {
        char tmp[10 + 1] = { 0 };
-       int ret = -EINVAL;
+       int ret = -EINVAL, res;
 
        if (count == 0)
                goto out;
        count = min_t(size_t, count, 10);
        memcpy(tmp, buf, count);
-       ret = simple_strtol(tmp, NULL, 10);
+       ret = kstrtoint(tmp, 10, &res);
+       if (!ret)
+               return res;
 out:
        return ret;
 }