aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/ss/hashtab.c
diff options
context:
space:
mode:
authorJames Morris <jmorris@namei.org>2005-10-30 17:59:21 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-30 20:37:11 -0500
commit89d155ef62e5e0c10e4b37aaa5056f0beafe10e6 (patch)
tree7de1f357efd619000970526ca2688f79b9022417 /security/selinux/ss/hashtab.c
parent0d078f6f96809c95c69b99d6605a502b0ac63d3d (diff)
[PATCH] SELinux: convert to kzalloc
This patch converts SELinux code from kmalloc/memset to the new kazalloc unction. On i386, this results in a text saving of over 1K. Before: text data bss dec hex filename 86319 4642 15236 106197 19ed5 security/selinux/built-in.o After: text data bss dec hex filename 85278 4642 15236 105156 19ac4 security/selinux/built-in.o Signed-off-by: James Morris <jmorris@namei.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'security/selinux/ss/hashtab.c')
-rw-r--r--security/selinux/ss/hashtab.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/security/selinux/ss/hashtab.c b/security/selinux/ss/hashtab.c
index 26661fcc00ce..24e5ec957630 100644
--- a/security/selinux/ss/hashtab.c
+++ b/security/selinux/ss/hashtab.c
@@ -15,11 +15,10 @@ struct hashtab *hashtab_create(u32 (*hash_value)(struct hashtab *h, void *key),
15 struct hashtab *p; 15 struct hashtab *p;
16 u32 i; 16 u32 i;
17 17
18 p = kmalloc(sizeof(*p), GFP_KERNEL); 18 p = kzalloc(sizeof(*p), GFP_KERNEL);
19 if (p == NULL) 19 if (p == NULL)
20 return p; 20 return p;
21 21
22 memset(p, 0, sizeof(*p));
23 p->size = size; 22 p->size = size;
24 p->nel = 0; 23 p->nel = 0;
25 p->hash_value = hash_value; 24 p->hash_value = hash_value;
@@ -55,10 +54,9 @@ int hashtab_insert(struct hashtab *h, void *key, void *datum)
55 if (cur && (h->keycmp(h, key, cur->key) == 0)) 54 if (cur && (h->keycmp(h, key, cur->key) == 0))
56 return -EEXIST; 55 return -EEXIST;
57 56
58 newnode = kmalloc(sizeof(*newnode), GFP_KERNEL); 57 newnode = kzalloc(sizeof(*newnode), GFP_KERNEL);
59 if (newnode == NULL) 58 if (newnode == NULL)
60 return -ENOMEM; 59 return -ENOMEM;
61 memset(newnode, 0, sizeof(*newnode));
62 newnode->key = key; 60 newnode->key = key;
63 newnode->datum = datum; 61 newnode->datum = datum;
64 if (prev) { 62 if (prev) {