Linux filesystem development
 help / color / mirror / Atom feed
* [PATCH] init: Replace simple_strtoul() with kstrtouint() in root_delay_setup()
@ 2025-11-03  8:06 Kaushlendra Kumar
  2025-11-03 12:06 ` Jan Kara
  2025-11-05 11:49 ` Christian Brauner
  0 siblings, 2 replies; 3+ messages in thread
From: Kaushlendra Kumar @ 2025-11-03  8:06 UTC (permalink / raw)
  To: viro, brauner, jack; +Cc: linux-fsdevel, Kaushlendra Kumar

Replace deprecated simple_strtoul() with kstrtouint() for better error
handling and input validation. Return 0 on parsing failure to indicate
invalid parameter, maintaining existing behavior for valid inputs.

The simple_strtoul() function is deprecated in favor of kstrtoint()
family functions which provide better error handling and are recommended
for new code and replacements.

Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
---
 init/do_mounts.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/init/do_mounts.c b/init/do_mounts.c
index 3c5fd993bc7e..3284226f7a2a 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -120,7 +120,8 @@ static int __init fs_names_setup(char *str)
 static unsigned int __initdata root_delay;
 static int __init root_delay_setup(char *str)
 {
-	root_delay = simple_strtoul(str, NULL, 0);
+	if (kstrtouint(str, 0, &root_delay))
+		return 0;
 	return 1;
 }
 
-- 
2.34.1


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

end of thread, other threads:[~2025-11-05 11:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-03  8:06 [PATCH] init: Replace simple_strtoul() with kstrtouint() in root_delay_setup() Kaushlendra Kumar
2025-11-03 12:06 ` Jan Kara
2025-11-05 11:49 ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox