Skip to content

Commit b29a0a3

Browse files
tobluxbrauner
authored andcommitted
dcache: Replace simple_strtoul with kstrtoul in set_dhash_entries
Replace simple_strtoul() with the recommended kstrtoul() for parsing the 'dhash_entries=' boot parameter. Check the return value of kstrtoul() and reject invalid values. This adds error handling while preserving behavior for existing values, and removes use of the deprecated simple_strtoul() helper. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Link: https://patch.msgid.link/20251216145236.44520-2-thorsten.blum@linux.dev Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 63ad216 commit b29a0a3

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

fs/dcache.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3227,10 +3227,7 @@ EXPORT_SYMBOL(d_parent_ino);
32273227
static __initdata unsigned long dhash_entries;
32283228
static int __init set_dhash_entries(char *str)
32293229
{
3230-
if (!str)
3231-
return 0;
3232-
dhash_entries = simple_strtoul(str, &str, 0);
3233-
return 1;
3230+
return kstrtoul(str, 0, &dhash_entries) == 0;
32343231
}
32353232
__setup("dhash_entries=", set_dhash_entries);
32363233

0 commit comments

Comments
 (0)