diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 76e5880cdb0748f3fa488f407021aa30d8978bb4..ffcb3b016843ff79976cee50ce6e9f332591c0ac 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -3408,9 +3408,15 @@ struct ip_rt_acct __percpu *ip_rt_acct __read_mostly; static __initdata unsigned long rhash_entries; static int __init set_rhash_entries(char *str) { + ssize_t ret; + if (!str) return 0; - rhash_entries = simple_strtoul(str, &str, 0); + + ret = kstrtoul(str, 0, &rhash_entries); + if (ret) + return 0; + return 1; } __setup("rhash_entries=", set_rhash_entries); diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 63ddaee7209f164b1f93baedd48639dcd1ad9c9a..e13546ca9923cc3845d7dbcecc623ce68434e089 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -3462,9 +3462,15 @@ extern struct tcp_congestion_ops tcp_reno; static __initdata unsigned long thash_entries; static int __init set_thash_entries(char *str) { + ssize_t ret; + if (!str) return 0; - thash_entries = simple_strtoul(str, &str, 0); + + ret = kstrtoul(str, 0, &thash_entries); + if (ret) + return 0; + return 1; } __setup("thash_entries=", set_thash_entries); diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 279fd084630223d984b05971457f7c9edc79c610..609397ee78fbd3ec9d16c249a6f023dd6903594f 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -2173,9 +2173,15 @@ void udp4_proc_exit(void) static __initdata unsigned long uhash_entries; static int __init set_uhash_entries(char *str) { + ssize_t ret; + if (!str) return 0; - uhash_entries = simple_strtoul(str, &str, 0); + + ret = kstrtoul(str, 0, &uhash_entries); + if (ret) + return 0; + if (uhash_entries && uhash_entries < UDP_HTABLE_SIZE_MIN) uhash_entries = UDP_HTABLE_SIZE_MIN; return 1;