summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorThorsten Blum <thorsten.blum@linux.dev>2025-12-17 12:02:13 +0100
committerAndrew Morton <akpm@linux-foundation.org>2026-01-20 19:24:47 -0800
commit84355caa271a0eab2d1b55ff73aa8aa3e4627661 (patch)
tree95d4e3fb92b0aeafb3e6baece0dfed133b2aef34 /include/linux
parenta98ec863fdedf4940447f32ceda7d937bebd06a2 (diff)
mm/mm_init: replace simple_strtoul with kstrtobool in set_hashdist
Use bool for 'hashdist' and replace simple_strtoul() with kstrtobool() for parsing the 'hashdist=' boot parameter. Unlike simple_strtoul(), which returns an unsigned long, kstrtobool() converts the string directly to bool and avoids implicit casting. Check the return value of kstrtobool() and reject invalid values. This adds error handling while preserving behavior for existing values, and removes use of the deprecated simple_strtoul() helper. The current code silently sets 'hashdist = 0' if parsing fails, instead of leaving the default value (HASHDIST_DEFAULT) unchanged. Additionally, kstrtobool() accepts common boolean strings such as "on" and "off". Link: https://lkml.kernel.org/r/20251217110214.50807-1-thorsten.blum@linux.dev Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/memblock.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 221118b5a16e..6ec5e9ac0699 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -598,9 +598,9 @@ extern void *alloc_large_system_hash(const char *tablename,
*/
#ifdef CONFIG_NUMA
#define HASHDIST_DEFAULT IS_ENABLED(CONFIG_64BIT)
-extern int hashdist; /* Distribute hashes across NUMA nodes? */
+extern bool hashdist; /* Distribute hashes across NUMA nodes? */
#else
-#define hashdist (0)
+#define hashdist (false)
#endif
#ifdef CONFIG_MEMTEST