aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/ss/conditional.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/selinux/ss/conditional.c')
-rw-r--r--security/selinux/ss/conditional.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c
index 34afeadd9e73..771c96afe1d5 100644
--- a/security/selinux/ss/conditional.c
+++ b/security/selinux/ss/conditional.c
@@ -176,8 +176,9 @@ void cond_policydb_destroy(struct policydb *p)
176int cond_init_bool_indexes(struct policydb *p) 176int cond_init_bool_indexes(struct policydb *p)
177{ 177{
178 kfree(p->bool_val_to_struct); 178 kfree(p->bool_val_to_struct);
179 p->bool_val_to_struct = 179 p->bool_val_to_struct = kmalloc_array(p->p_bools.nprim,
180 kmalloc(p->p_bools.nprim * sizeof(struct cond_bool_datum *), GFP_KERNEL); 180 sizeof(*p->bool_val_to_struct),
181 GFP_KERNEL);
181 if (!p->bool_val_to_struct) 182 if (!p->bool_val_to_struct)
182 return -ENOMEM; 183 return -ENOMEM;
183 return 0; 184 return 0;
@@ -226,7 +227,7 @@ int cond_read_bool(struct policydb *p, struct hashtab *h, void *fp)
226 u32 len; 227 u32 len;
227 int rc; 228 int rc;
228 229
229 booldatum = kzalloc(sizeof(struct cond_bool_datum), GFP_KERNEL); 230 booldatum = kzalloc(sizeof(*booldatum), GFP_KERNEL);
230 if (!booldatum) 231 if (!booldatum)
231 return -ENOMEM; 232 return -ENOMEM;
232 233
@@ -331,7 +332,7 @@ static int cond_insertf(struct avtab *a, struct avtab_key *k, struct avtab_datum
331 goto err; 332 goto err;
332 } 333 }
333 334
334 list = kzalloc(sizeof(struct cond_av_list), GFP_KERNEL); 335 list = kzalloc(sizeof(*list), GFP_KERNEL);
335 if (!list) { 336 if (!list) {
336 rc = -ENOMEM; 337 rc = -ENOMEM;
337 goto err; 338 goto err;
@@ -420,7 +421,7 @@ static int cond_read_node(struct policydb *p, struct cond_node *node, void *fp)
420 goto err; 421 goto err;
421 422
422 rc = -ENOMEM; 423 rc = -ENOMEM;
423 expr = kzalloc(sizeof(struct cond_expr), GFP_KERNEL); 424 expr = kzalloc(sizeof(*expr), GFP_KERNEL);
424 if (!expr) 425 if (!expr)
425 goto err; 426 goto err;
426 427
@@ -471,7 +472,7 @@ int cond_read_list(struct policydb *p, void *fp)
471 472
472 for (i = 0; i < len; i++) { 473 for (i = 0; i < len; i++) {
473 rc = -ENOMEM; 474 rc = -ENOMEM;
474 node = kzalloc(sizeof(struct cond_node), GFP_KERNEL); 475 node = kzalloc(sizeof(*node), GFP_KERNEL);
475 if (!node) 476 if (!node)
476 goto err; 477 goto err;
477 478
@@ -663,5 +664,4 @@ void cond_compute_av(struct avtab *ctab, struct avtab_key *key,
663 (node->key.specified & AVTAB_XPERMS)) 664 (node->key.specified & AVTAB_XPERMS))
664 services_compute_xperms_drivers(xperms, node); 665 services_compute_xperms_drivers(xperms, node);
665 } 666 }
666 return;
667} 667}