]> err.no Git - linux-2.6/blobdiff - security/selinux/ss/conditional.c
Merge branch 'fixes' of master.kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6
[linux-2.6] / security / selinux / ss / conditional.c
index daf2880074607fd535080ed6a08bebd3a36a3082..50ad85d4b77c88c3ab61828ba2161bce8ad8315f 100644 (file)
@@ -220,10 +220,9 @@ int cond_read_bool(struct policydb *p, struct hashtab *h, void *fp)
        u32 len;
        int rc;
 
-       booldatum = kmalloc(sizeof(struct cond_bool_datum), GFP_KERNEL);
+       booldatum = kzalloc(sizeof(struct cond_bool_datum), GFP_KERNEL);
        if (!booldatum)
                return -1;
-       memset(booldatum, 0, sizeof(struct cond_bool_datum));
 
        rc = next_entry(buf, fp, sizeof buf);
        if (rc < 0)
@@ -321,10 +320,9 @@ static int cond_insertf(struct avtab *a, struct avtab_key *k, struct avtab_datum
                goto err;
        }
 
-       list = kmalloc(sizeof(struct cond_av_list), GFP_KERNEL);
+       list = kzalloc(sizeof(struct cond_av_list), GFP_KERNEL);
        if (!list)
                goto err;
-       memset(list, 0, sizeof(*list));
 
        list->node = node_ptr;
        if (!data->head)
@@ -364,7 +362,8 @@ static int cond_read_av_list(struct policydb *p, void *fp, struct cond_av_list *
        data.head = NULL;
        data.tail = NULL;
        for (i = 0; i < len; i++) {
-               rc = avtab_read_item(fp, p->policyvers, &p->te_cond_avtab, cond_insertf, &data);
+               rc = avtab_read_item(&p->te_cond_avtab, fp, p, cond_insertf,
+                                    &data);
                if (rc)
                        return rc;
 
@@ -414,11 +413,10 @@ static int cond_read_node(struct policydb *p, struct cond_node *node, void *fp)
                if (rc < 0)
                        goto err;
 
-               expr = kmalloc(sizeof(struct cond_expr), GFP_KERNEL);
+               expr = kzalloc(sizeof(struct cond_expr), GFP_KERNEL);
                if (!expr) {
                        goto err;
                }
-               memset(expr, 0, sizeof(struct cond_expr));
 
                expr->expr_type = le32_to_cpu(buf[0]);
                expr->bool = le32_to_cpu(buf[1]);
@@ -459,11 +457,14 @@ int cond_read_list(struct policydb *p, void *fp)
 
        len = le32_to_cpu(buf[0]);
 
+       rc = avtab_alloc(&(p->te_cond_avtab), p->te_avtab.nel);
+       if (rc)
+               goto err;
+
        for (i = 0; i < len; i++) {
-               node = kmalloc(sizeof(struct cond_node), GFP_KERNEL);
+               node = kzalloc(sizeof(struct cond_node), GFP_KERNEL);
                if (!node)
                        goto err;
-               memset(node, 0, sizeof(struct cond_node));
 
                if (cond_read_node(p, node, fp) != 0)
                        goto err;