From: Jakub Kicinski <kuba@kernel.org>
To: sajal2005gupta@gmail.com
Cc: Jakub Kicinski <kuba@kernel.org>,
petkan@nucleusys.com, andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@google.com, pabeni@redhat.com,
linux-usb@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] net: usb: pegasus: replace simple_strtoul with kstrtouint
Date: Fri, 8 May 2026 18:17:01 -0700 [thread overview]
Message-ID: <20260509011701.3536125-1-kuba@kernel.org> (raw)
In-Reply-To: <20260506152653.52329-1-sajal2005gupta@gmail.com>
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
---
net: usb: pegasus: replace simple_strtoul with kstrtouint
This patch replaces the deprecated simple_strtoul() function with
kstrtouint() when parsing device IDs in the pegasus driver. It also
adds error checking to abort on invalid inputs.
> diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
> index db85f40734d7b..d45f08f8f22ee 100644
> --- a/drivers/net/usb/pegasus.c
> +++ b/drivers/net/usb/pegasus.c
[ ... ]
> @@ -1327,15 +1327,29 @@ static void __init parse_id(char *id)
> {
[ ... ]
> - if ((token = strsep(&id, ":")) != NULL)
> - device_id = simple_strtoul(token, NULL, 16);
> - flags = simple_strtoul(id, NULL, 16);
> + token = strsep(&id, ":");
> + if (token) {
> + err = kstrtouint(token, 16, &device_id);
> + if (err)
> + return;
> + }
> + if (id) {
> + err = kstrtouint(id, 16, &flags);
> + if (err)
> + return;
Does this stricter parsing silently break previously working module parameter
formats?
In the original code, simple_strtoul() would leniently parse an empty string
as 0. If a user provided a trailing colon to omit the flags parameter
(for example, name:1234:5678:), id becomes an empty string.
Since kstrtouint() strictly rejects empty strings and returns -EINVAL,
this will now take the error path and return. Because there is no logging
on this error path, device registration will be silently aborted.
Could this be updated to either handle empty strings or log a warning so
users know why their configuration stopped working?
> + }
> pr_info("%s: new device %s, vendor ID 0x%04x, device ID 0x%04x, flags: 0x%x\n",
> driver_name, name, vendor_id, device_id, flags);
--
pw-bot: cr
next prev parent reply other threads:[~2026-05-09 1:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-06 15:26 [PATCH net-next] net: usb: pegasus: replace simple_strtoul with kstrtouint Sajal Gupta
2026-05-09 1:17 ` Jakub Kicinski [this message]
2026-05-09 1:17 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260509011701.3536125-1-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petkan@nucleusys.com \
--cc=sajal2005gupta@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox