mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: 林濬哲 <m18667909625@163.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>,
	linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
	m18667909625@163.com
Subject: [PATCH v3 2/2] watchdog: use kstrtouint to parse softlockup_panic=
Date: Tue, 22 Sep 2026 22:49:52 +0800	[thread overview]
Message-ID: <20260922153000.10086.2-m18667909625@163.com> (raw)
In-Reply-To: <e5bc7dc4-3faa-491f-9c8d-62afe0be0bbd@roeck-us.net>


simple_strtoul() is deprecated. Use kstrtouint() instead; on a parse
error the variable is now left unchanged instead of being silently
clamped.

__setup() handlers return whether they handled the option and cannot
propagate parse errors, so the handler simply returns 1.

v3: do not warn on parse errors (Guenter Roeck).

Signed-off-by: Lin Junzhe <m18667909625@163.com>
Assisted-by: AI coding assistant (per kernel AI guidelines)
---
 kernel/watchdog.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 420f08140713..69cd5ebb4929 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -423,10 +423,11 @@ static unsigned long soft_lockup_nmi_warn;
 
 static int __init softlockup_panic_setup(char *str)
 {
-	int ret;
+	unsigned int val;
 
-	ret = kstrtouint(str, 0, &softlockup_panic);
-	return ret ? ret : 1;
+	if (!kstrtouint(str, 0, &val))
+		softlockup_panic = val;
+	return 1;
 }
 __setup("softlockup_panic=", softlockup_panic_setup);
 
-- 
2.54.0.windows.1



  parent reply	other threads:[~2026-09-22 14:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21  6:41 [PATCH 1/2] " 林濬哲
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
2026-09-21  6:29       ` [PATCH v3 1/2] PM: hibernate: use kstrtouint to parse resume= device numbers 林濬哲
2026-09-22 14:49       ` 林濬哲 [this message]
2026-09-22 16:02         ` [PATCH v3 2/2] watchdog: use kstrtouint to parse softlockup_panic= 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=20260922153000.10086.2-m18667909625@163.com \
    --to=m18667909625@163.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --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®