Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 78386
b: refs/heads/master
c: ea72912
h: refs/heads/master
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Jan 28, 2008
1 parent cc30bf7 commit 760742b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 64b7d96167977850f4a24e52dd0a76b03c6542cf
refs/heads/master: ea72912c888661d1a847f1b1450643d4114097cf
13 changes: 6 additions & 7 deletions trunk/net/netlink/af_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,14 @@ static inline struct sock *netlink_lookup(struct net *net, int protocol,
return sk;
}

static inline struct hlist_head *nl_pid_hash_alloc(size_t size)
static inline struct hlist_head *nl_pid_hash_zalloc(size_t size)
{
if (size <= PAGE_SIZE)
return kmalloc(size, GFP_ATOMIC);
return kzalloc(size, GFP_ATOMIC);
else
return (struct hlist_head *)
__get_free_pages(GFP_ATOMIC, get_order(size));
__get_free_pages(GFP_ATOMIC | __GFP_ZERO,
get_order(size));
}

static inline void nl_pid_hash_free(struct hlist_head *table, size_t size)
Expand Down Expand Up @@ -272,11 +273,10 @@ static int nl_pid_hash_rehash(struct nl_pid_hash *hash, int grow)
size *= 2;
}

table = nl_pid_hash_alloc(size);
table = nl_pid_hash_zalloc(size);
if (!table)
return 0;

memset(table, 0, size);
otable = hash->table;
hash->table = table;
hash->mask = mask;
Expand Down Expand Up @@ -1919,15 +1919,14 @@ static int __init netlink_proto_init(void)
for (i = 0; i < MAX_LINKS; i++) {
struct nl_pid_hash *hash = &nl_table[i].hash;

hash->table = nl_pid_hash_alloc(1 * sizeof(*hash->table));
hash->table = nl_pid_hash_zalloc(1 * sizeof(*hash->table));
if (!hash->table) {
while (i-- > 0)
nl_pid_hash_free(nl_table[i].hash.table,
1 * sizeof(*hash->table));
kfree(nl_table);
goto panic;
}
memset(hash->table, 0, 1 * sizeof(*hash->table));
hash->max_shift = order;
hash->shift = 0;
hash->mask = 0;
Expand Down

0 comments on commit 760742b

Please sign in to comment.