* [PATCH] usb: misc: usbsevseg: replace deprecated simple_strtoul with kstrtouint
@ 2026-06-22 12:50 Jad Keskes
2026-06-22 13:03 ` Oliver Neukum
0 siblings, 1 reply; 2+ messages in thread
From: Jad Keskes @ 2026-06-22 12:50 UTC (permalink / raw)
To: gregkh; +Cc: linux-usb, linux-kernel, Jad Keskes
simple_strtoul() is deprecated. kstrtouint() actually tells you when
the input is garbage instead of silently accepting zero.
Fixes 3 sysfs store paths (powered, mode_msb, mode_lsb) from one
macro expansion.
Signed-off-by: Jad Keskes <inasj268@gmail.com>
---
drivers/usb/misc/usbsevseg.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/misc/usbsevseg.c b/drivers/usb/misc/usbsevseg.c
index 89d25fcef642..2c08d8ee7d86 100644
--- a/drivers/usb/misc/usbsevseg.c
+++ b/drivers/usb/misc/usbsevseg.c
@@ -154,7 +154,13 @@ static ssize_t name##_store(struct device *dev, \
struct usb_interface *intf = to_usb_interface(dev); \
struct usb_sevsegdev *mydev = usb_get_intfdata(intf); \
\
- mydev->name = simple_strtoul(buf, NULL, 10); \
+ unsigned int val; \
+ int ret; \
+ \
+ ret = kstrtouint(buf, 10, &val); \
+ if (ret < 0) \
+ return ret; \
+ mydev->name = val; \
update_fcn(mydev); \
\
return count; \
--
2.54.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] usb: misc: usbsevseg: replace deprecated simple_strtoul with kstrtouint
2026-06-22 12:50 [PATCH] usb: misc: usbsevseg: replace deprecated simple_strtoul with kstrtouint Jad Keskes
@ 2026-06-22 13:03 ` Oliver Neukum
0 siblings, 0 replies; 2+ messages in thread
From: Oliver Neukum @ 2026-06-22 13:03 UTC (permalink / raw)
To: Jad Keskes, gregkh; +Cc: linux-usb, linux-kernel
On 22.06.26 14:50, Jad Keskes wrote:
> simple_strtoul() is deprecated. kstrtouint() actually tells you when
> the input is garbage instead of silently accepting zero.
That changes the API visible to user space. Is this a good idea?
Regards
Oliver
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-22 13:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-22 12:50 [PATCH] usb: misc: usbsevseg: replace deprecated simple_strtoul with kstrtouint Jad Keskes
2026-06-22 13:03 ` Oliver Neukum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®