From: Guenter Roeck <linux@roeck-us.net>
To: 林濬哲 <m18667909625@163.com>
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>,
linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] watchdog: use kstrtouint to parse softlockup_panic=
Date: Tue, 22 Sep 2026 06:28:42 -0700 [thread overview]
Message-ID: <e5bc7dc4-3faa-491f-9c8d-62afe0be0bbd@roeck-us.net> (raw)
In-Reply-To: <20260922060000.10086.1-m18667909625@163.com>
On Tue, Sep 22, 2026 at 01:50:40PM +0800, 林濬哲 wrote:
>
> simple_strtoul() is deprecated. Replace it with kstrtouint(). A bad
> value now leaves the variable unchanged and produces a warning,
> instead of being silently clamped.
>
> __setup() handlers return whether they handled the option; there is
> no way to propagate parse errors, so the handler simply returns 1.
>
> v2: warn on a bad value and return 1 instead of returning the parse
> error, which __setup() handlers cannot do (Guenter Roeck).
>
> Signed-off-by: Lin Junzhe <m18667909625@163.com>
> Assisted-by: AI coding assistant (disclosed per kernel AI guidelines)
> ---
> kernel/watchdog.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/watchdog.c b/kernel/watchdog.c
> index e5134ad7b663..7f8c904554a9 100644
> --- a/kernel/watchdog.c
> +++ b/kernel/watchdog.c
> @@ -17,6 +17,7 @@
> #include <linux/irq.h>
> #include <linux/irqdesc.h>
> #include <linux/kernel_stat.h>
> +#include <linux/kstrtox.h>
> #include <linux/kvm_para.h>
> #include <linux/math64.h>
> #include <linux/mm.h>
> @@ -422,7 +423,11 @@ static unsigned long soft_lockup_nmi_warn;
>
> static int __init softlockup_panic_setup(char *str)
> {
> - softlockup_panic = simple_strtoul(str, NULL, 0);
> + int ret;
> +
> + ret = kstrtouint(str, 0, &softlockup_panic);
> + if (ret)
> + pr_warn("softlockup_panic: bad option string '%s'\n", str);
Hardly any other __setup function warns here, and I do not see the point
adding it here.
Guenter
> return 1;
> }
> __setup("softlockup_panic=", softlockup_panic_setup);
> --
> 2.54.0.windows.1
>
>
next prev parent reply other threads:[~2026-09-22 13:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 6:41 [PATCH " 林濬哲
2026-09-21 14:21 ` Guenter Roeck
2026-09-21 6:29 ` [PATCH v2 2/2] PM: hibernate: use kstrtouint to parse resume= device numbers 林濬哲
2026-09-22 5:50 ` [PATCH v2 1/2] watchdog: use kstrtouint to parse softlockup_panic= 林濬哲
2026-09-22 13:28 ` Guenter Roeck [this message]
2026-09-21 6:29 ` [PATCH v3 1/2] PM: hibernate: use kstrtouint to parse resume= device numbers 林濬哲
2026-09-22 14:49 ` [PATCH v3 2/2] watchdog: use kstrtouint to parse softlockup_panic= 林濬哲
2026-09-22 16:02 ` Guenter Roeck
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=e5bc7dc4-3faa-491f-9c8d-62afe0be0bbd@roeck-us.net \
--to=linux@roeck-us.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=m18667909625@163.com \
--cc=wim@linux-watchdog.org \
/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
all inboxes | Powered by JetHome®