aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2009-12-06 04:16:51 -0500
committerJames Morris <jmorris@namei.org>2009-12-07 22:57:54 -0500
commit9f59f90bf57cff8be07faddc608c400b6e7c5d05 (patch)
tree621e4fa6dae193b3427913a1945eee473f47b153 /security
parent6ec22f9b037fc0c2e00ddb7023fad279c365324d (diff)
security/selinux/ss: correct size computation
The size argument to kcalloc should be the size of desired structure, not the pointer to it. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @expression@ expression *x; @@ x = <+... -sizeof(x) +sizeof(*x) ...+>// </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Acked-by: Eric Paris <eparis@redhat.com> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security')
-rw-r--r--security/selinux/ss/services.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index d6bb20cbad62..07ddc81d7b57 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -2555,7 +2555,7 @@ int security_get_classes(char ***classes, int *nclasses)
2555 read_lock(&policy_rwlock); 2555 read_lock(&policy_rwlock);
2556 2556
2557 *nclasses = policydb.p_classes.nprim; 2557 *nclasses = policydb.p_classes.nprim;
2558 *classes = kcalloc(*nclasses, sizeof(*classes), GFP_ATOMIC); 2558 *classes = kcalloc(*nclasses, sizeof(**classes), GFP_ATOMIC);
2559 if (!*classes) 2559 if (!*classes)
2560 goto out; 2560 goto out;
2561 2561
@@ -2602,7 +2602,7 @@ int security_get_permissions(char *class, char ***perms, int *nperms)
2602 } 2602 }
2603 2603
2604 *nperms = match->permissions.nprim; 2604 *nperms = match->permissions.nprim;
2605 *perms = kcalloc(*nperms, sizeof(*perms), GFP_ATOMIC); 2605 *perms = kcalloc(*nperms, sizeof(**perms), GFP_ATOMIC);
2606 if (!*perms) 2606 if (!*perms)
2607 goto out; 2607 goto out;
2608 2608