b43legacy: replace simple_strtol() with kstrtoint()

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>
This commit is contained in:
chenqiwu 2020-02-19 12:15:59 +08:00 committed by Kalle Valo
parent 90a39326f1
commit 871b4b48cd

View file

@ -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;
}