mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] watchdog: use kstrtouint to parse softlockup_panic=
@ 2026-09-21  6:41 林濬哲
  2026-09-21 14:21 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: 林濬哲 @ 2026-09-21  6:41 UTC (permalink / raw)
  To: Wim Van Sebroeck
  Cc: Guenter Roeck, linux-watchdog, linux-kernel, m18667909625

simple_strtoul() is deprecated. Replace it with kstrtouint(), which
also reports parse errors back to the boot process instead of
silently accepting garbage.

Signed-off-by: 林濬哲 <m18667909625@163.com>
Assisted-by: AI coding assistant (disclosed per kernel AI guidelines)
---
 kernel/watchdog.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index e5134ad7b663..420f08140713 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,8 +423,10 @@ static unsigned long soft_lockup_nmi_warn;
 
 static int __init softlockup_panic_setup(char *str)
 {
-	softlockup_panic = simple_strtoul(str, NULL, 0);
-	return 1;
+	int ret;
+
+	ret = kstrtouint(str, 0, &softlockup_panic);
+	return ret ? ret : 1;
 }
 __setup("softlockup_panic=", softlockup_panic_setup);
 
-- 
2.53.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2] watchdog: use kstrtouint to parse softlockup_panic=
  2026-09-21  6:41 [PATCH 1/2] watchdog: use kstrtouint to parse softlockup_panic= 林濬哲
@ 2026-09-21 14:21 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2026-09-21 14:21 UTC (permalink / raw)
  To: 林濬哲; +Cc: Wim Van Sebroeck, linux-watchdog, linux-kernel

On Mon, Sep 21, 2026 at 02:41:43PM +0800, 林濬哲 wrote:
> simple_strtoul() is deprecated. Replace it with kstrtouint(), which
> also reports parse errors back to the boot process instead of
> silently accepting garbage.
> 
> Signed-off-by: 林濬哲 <m18667909625@163.com>
> Assisted-by: AI coding assistant (disclosed per kernel AI guidelines)
> ---
>  kernel/watchdog.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/watchdog.c b/kernel/watchdog.c
> index e5134ad7b663..420f08140713 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,8 +423,10 @@ static unsigned long soft_lockup_nmi_warn;
>  
>  static int __init softlockup_panic_setup(char *str)
>  {
> -	softlockup_panic = simple_strtoul(str, NULL, 0);
> -	return 1;
> +	int ret;
> +
> +	ret = kstrtouint(str, 0, &softlockup_panic);
> +	return ret ? ret : 1;

Please read the documentation (or ask your AI to do it).

/*
 * NOTE: __setup functions return values:
 * @fn returns 1 (or non-zero) if the option argument is "handled"
 * and returns 0 if the option argument is "not handled".
 */

There is no means to "reports parse errors back to the boot process"
from __setup functions.

Guenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-21 14:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-21  6:41 [PATCH 1/2] watchdog: use kstrtouint to parse softlockup_panic= 林濬哲
2026-09-21 14:21 ` Guenter Roeck

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®