Skip to contentSkip to conversation

x86/vdso: Replace simple_strtoul with kstrtouint in vdso{32}_setup

PATCH Superseded Thorsten Blum 1 participant 1 message Dec 18, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/vdso: Replace simple_strtoul with kstrtouint in vdso{32}_setup

Replace simple_strtoul() with the recommended kstrtouint() for parsing the 'vdso=' and 'vdso32=' boot parameters. Unlike simple_strtoul(), which returns an unsigned long, kstrtouint() converts the string directly to an unsigned integer.

Check the return value of kstrtouint() and reject invalid values. This adds error handling while preserving existing behavior for valid values, and removes use of the deprecated simple_strtoul() helper.

---
 arch/x86/entry/vdso/vdso32-setup.c | 4 +---
 arch/x86/entry/vdso/vma.c          | 3 +--
 2 files changed, 2 insertions(+), 5 deletions(-)
arch/x86/entry/vdso/vdso32-setup.c +1 -3
index 8894013eea1d..9556633c8f93 100644
@@ -30,9 +30,7 @@ unsigned int __read_mostly vdso32_enabled = VDSO_DEFAULT;
 
 static int __init vdso32_setup(char *s)
 {
-	vdso32_enabled = simple_strtoul(s, NULL, 0);
-
-	if (vdso32_enabled > 1) {
+	if (kstrtouint(s, 0, &vdso32_enabled) || vdso32_enabled > 1) {
 		pr_warn("vdso32 values other than 0 and 1 are no longer allowed; vdso disabled\n");
 		vdso32_enabled = 0;
 	}
arch/x86/entry/vdso/vma.c +1 -2
index afe105b2f907..468e0464be36 100644
@@ -278,8 +278,7 @@ bool arch_syscall_is_vdso_sigreturn(struct pt_regs *regs)
 #ifdef CONFIG_X86_64
 static __init int vdso_setup(char *s)
 {
-	vdso64_enabled = simple_strtoul(s, NULL, 0);
-	return 1;
+	return kstrtouint(s, 0, &vdso64_enabled) == 0;
 }
 __setup("vdso=", vdso_setup);
 #endif /* CONFIG_X86_64 */
Signature · 2 lines
Thorsten Blum <[email protected]>
GPG: 1D60 735E 8AEF 3BE4 73B6  9D84 7336 78FD 8DFE EAD4