net/ipv4: replace simple_strtoul with kstrtoul
Subsystems (5)
PATCH 1/1 net/ipv4: replace simple_strtoul with kstrtoul
Replace simple_strtoul with kstrtoul in three similar occurrences, all setup handlers:
* route.c: set_rhash_entries
* tcp.c: set_thash_entries
* udp.c: set_uhash_entries
Also check if the conversion failed.
Signed-off-by Eldad Zack <[email protected]>
--- net/ipv4/route.c | 8 +++++++- net/ipv4/tcp.c | 8 +++++++- net/ipv4/udp.c | 8 +++++++- 3 files changed, 21 insertions(+), 3 deletions(-)
net/ipv4/route.c +7 -1
@@ -3430,9 +3430,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);
net/ipv4/tcp.c +7 -1
@@ -3222,9 +3222,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);
net/ipv4/udp.c +7 -1
@@ -2163,9 +2163,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 ;
Signature · 1 line
1.7.10
From: Eldad Zack <[email protected]>
Date: Sun, 20 May 2012 02:13:18 +0200
Quoted 9 lines
Replace
simple_strtoulwith kstrtoul in three similar occurrences, all setup handlers:
*route.c:set_rhash_entries
*tcp.c:set_thash_entries
*udp.c:set_uhash_entriesAlso check if the conversion failed.
Signed-off-by Eldad Zack <[email protected]>
Applied.