Skip to content

Commit

Permalink
b43legacy: replace simple_strtol() with kstrtoint()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
chenqiwu authored and Kalle Valo committed Mar 12, 2020
1 parent 90a3932 commit 871b4b4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/net/wireless/broadcom/b43legacy/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@
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;
}
Expand Down

0 comments on commit 871b4b4

Please sign in to comment.