aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/ss/conditional.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/conditional.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/conditional.c')
-rw-r--r--security/selinux/ss/conditional.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c
index daf288007460..d2737edba541 100644
--- a/security/selinux/ss/conditional.c
+++ b/security/selinux/ss/conditional.c
@@ -220,10 +220,9 @@ int cond_read_bool(struct policydb *p, struct hashtab *h, void *fp)
220 u32 len; 220 u32 len;
221 int rc; 221 int rc;
222 222
223 booldatum = kmalloc(sizeof(struct cond_bool_datum), GFP_KERNEL); 223 booldatum = kzalloc(sizeof(struct cond_bool_datum), GFP_KERNEL);
224 if (!booldatum) 224 if (!booldatum)
225 return -1; 225 return -1;
226 memset(booldatum, 0, sizeof(struct cond_bool_datum));
227 226
228 rc = next_entry(buf, fp, sizeof buf); 227 rc = next_entry(buf, fp, sizeof buf);
229 if (rc < 0) 228 if (rc < 0)
@@ -321,10 +320,9 @@ static int cond_insertf(struct avtab *a, struct avtab_key *k, struct avtab_datum
321 goto err; 320 goto err;
322 } 321 }
323 322
324 list = kmalloc(sizeof(struct cond_av_list), GFP_KERNEL); 323 list = kzalloc(sizeof(struct cond_av_list), GFP_KERNEL);
325 if (!list) 324 if (!list)
326 goto err; 325 goto err;
327 memset(list, 0, sizeof(*list));
328 326
329 list->node = node_ptr; 327 list->node = node_ptr;
330 if (!data->head) 328 if (!data->head)
@@ -414,11 +412,10 @@ static int cond_read_node(struct policydb *p, struct cond_node *node, void *fp)
414 if (rc < 0) 412 if (rc < 0)
415 goto err; 413 goto err;
416 414
417 expr = kmalloc(sizeof(struct cond_expr), GFP_KERNEL); 415 expr = kzalloc(sizeof(struct cond_expr), GFP_KERNEL);
418 if (!expr) { 416 if (!expr) {
419 goto err; 417 goto err;
420 } 418 }
421 memset(expr, 0, sizeof(struct cond_expr));
422 419
423 expr->expr_type = le32_to_cpu(buf[0]); 420 expr->expr_type = le32_to_cpu(buf[0]);
424 expr->bool = le32_to_cpu(buf[1]); 421 expr->bool = le32_to_cpu(buf[1]);
@@ -460,10 +457,9 @@ int cond_read_list(struct policydb *p, void *fp)
460 len = le32_to_cpu(buf[0]); 457 len = le32_to_cpu(buf[0]);
461 458
462 for (i = 0; i < len; i++) { 459 for (i = 0; i < len; i++) {
463 node = kmalloc(sizeof(struct cond_node), GFP_KERNEL); 460 node = kzalloc(sizeof(struct cond_node), GFP_KERNEL);
464 if (!node) 461 if (!node)
465 goto err; 462 goto err;
466 memset(node, 0, sizeof(struct cond_node));
467 463
468 if (cond_read_node(p, node, fp) != 0) 464 if (cond_read_node(p, node, fp) != 0)
469 goto err; 465 goto err;