Skip to contentSkip to conversation

b43legacy/sysfs.c: replace simple_strtol() with kstrtoint()

PATCH In review [email protected] 2 participants 2 messages Feb 19, 2020 – Mar 12, 2020 B43LEGACY wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 b43legacy/sysfs.c: replace simple_strtol() with kstrtoint()

From: chenqiwu <[email protected]>

The simple_strtol() function is deprecated since it does not check for the range overflow. Use kstrtoint() instead.

---
 drivers/net/wireless/broadcom/b43legacy/sysfs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/broadcom/b43legacy/sysfs.c +4 -2
index 9312c1d..eec087c 100644
@@ -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;
 }
Signature · 1 line
1.9.1
#1 lore raw

Re: [PATCH] b43legacy: replace simple_strtol() with kstrtoint()

Quoted 6 lines · [email protected] wrote:

From: chenqiwu <[email protected]>

The simple_strtol() function is deprecated since it does not check for the range overflow. Use kstrtoint() instead.

Patch applied to wireless-drivers-next.git, thanks.

871b4b48cdbf b43legacy: replace simple_strtol() with kstrtoint()

Signature · 3 lines
https://patchwork.kernel.org/patch/11390321/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches