aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/netlink/af_netlink.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 2e02b19e4552..dbd7cad1c9a9 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -237,13 +237,14 @@ found:
237 return sk; 237 return sk;
238} 238}
239 239
240static inline struct hlist_head *nl_pid_hash_alloc(size_t size) 240static inline struct hlist_head *nl_pid_hash_zalloc(size_t size)
241{ 241{
242 if (size <= PAGE_SIZE) 242 if (size <= PAGE_SIZE)
243 return kmalloc(size, GFP_ATOMIC); 243 return kzalloc(size, GFP_ATOMIC);
244 else 244 else
245 return (struct hlist_head *) 245 return (struct hlist_head *)
246 __get_free_pages(GFP_ATOMIC, get_order(size)); 246 __get_free_pages(GFP_ATOMIC | __GFP_ZERO,
247 get_order(size));
247} 248}
248 249
249static inline void nl_pid_hash_free(struct hlist_head *table, size_t size) 250static inline void nl_pid_hash_free(struct hlist_head *table, size_t size)
@@ -272,11 +273,10 @@ static int nl_pid_hash_rehash(struct nl_pid_hash *hash, int grow)
272 size *= 2; 273 size *= 2;
273 } 274 }
274 275
275 table = nl_pid_hash_alloc(size); 276 table = nl_pid_hash_zalloc(size);
276 if (!table) 277 if (!table)
277 return 0; 278 return 0;
278 279
279 memset(table, 0, size);
280 otable = hash->table; 280 otable = hash->table;
281 hash->table = table; 281 hash->table = table;
282 hash->mask = mask; 282 hash->mask = mask;
@@ -1919,7 +1919,7 @@ static int __init netlink_proto_init(void)
1919 for (i = 0; i < MAX_LINKS; i++) { 1919 for (i = 0; i < MAX_LINKS; i++) {
1920 struct nl_pid_hash *hash = &nl_table[i].hash; 1920 struct nl_pid_hash *hash = &nl_table[i].hash;
1921 1921
1922 hash->table = nl_pid_hash_alloc(1 * sizeof(*hash->table)); 1922 hash->table = nl_pid_hash_zalloc(1 * sizeof(*hash->table));
1923 if (!hash->table) { 1923 if (!hash->table) {
1924 while (i-- > 0) 1924 while (i-- > 0)
1925 nl_pid_hash_free(nl_table[i].hash.table, 1925 nl_pid_hash_free(nl_table[i].hash.table,
@@ -1927,7 +1927,6 @@ static int __init netlink_proto_init(void)
1927 kfree(nl_table); 1927 kfree(nl_table);
1928 goto panic; 1928 goto panic;
1929 } 1929 }
1930 memset(hash->table, 0, 1 * sizeof(*hash->table));
1931 hash->max_shift = order; 1930 hash->max_shift = order;
1932 hash->shift = 0; 1931 hash->shift = 0;
1933 hash->mask = 0; 1932 hash->mask = 0;