From: Thorsten Blum <thorsten.blum@linux.dev>
To: Christian Brauner <brauner@kernel.org>
Cc: Thorsten Blum <thorsten.blum@linux.dev>, linux-kernel@vger.kernel.org
Subject: [PATCH RESEND] init: Replace simple_strtoul with kstrtoul to improve lpj_setup
Date: Mon, 13 Oct 2025 15:27:06 +0200 [thread overview]
Message-ID: <20251013132708.31923-2-thorsten.blum@linux.dev> (raw)
Replace simple_strtoul() with the recommended kstrtoul() for parsing the
'lpj=' boot parameter.
Check the return value of kstrtoul() and reject invalid values. This
adds error handling while preserving existing behavior for valid values,
and removes use of the deprecated simple_strtoul() helper.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
init/calibrate.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/init/calibrate.c b/init/calibrate.c
index f3831272f113..09c2e6102110 100644
--- a/init/calibrate.c
+++ b/init/calibrate.c
@@ -14,10 +14,10 @@
unsigned long lpj_fine;
unsigned long preset_lpj;
+
static int __init lpj_setup(char *str)
{
- preset_lpj = simple_strtoul(str,NULL,0);
- return 1;
+ return kstrtoul(str, 0, &preset_lpj) == 0;
}
__setup("lpj=", lpj_setup);
--
2.51.0
next reply other threads:[~2025-10-13 13:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-13 13:27 Thorsten Blum [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-11-22 11:45 [PATCH RESEND] init: Replace simple_strtoul with kstrtoul to improve lpj_setup Thorsten Blum
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=20251013132708.31923-2-thorsten.blum@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=brauner@kernel.org \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.