* [PATCH RESEND] init: Replace simple_strtoul with kstrtoul to improve lpj_setup
@ 2025-10-13 13:27 Thorsten Blum
0 siblings, 0 replies; 2+ messages in thread
From: Thorsten Blum @ 2025-10-13 13:27 UTC (permalink / raw)
To: Christian Brauner; +Cc: Thorsten Blum, linux-kernel
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH RESEND] init: Replace simple_strtoul with kstrtoul to improve lpj_setup
@ 2025-11-22 11:45 Thorsten Blum
0 siblings, 0 replies; 2+ messages in thread
From: Thorsten Blum @ 2025-11-22 11:45 UTC (permalink / raw)
To: Christian Brauner, Andrew Morton, Peter Zijlstra
Cc: Thorsten Blum, linux-kernel
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.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-11-22 11:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-22 11:45 [PATCH RESEND] init: Replace simple_strtoul with kstrtoul to improve lpj_setup Thorsten Blum
-- strict thread matches above, loose matches on Subject: below --
2025-10-13 13:27 Thorsten Blum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox