mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 19:29:37 +00:00
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>
This commit is contained in:
parent
6ec22f9b03
commit
9f59f90bf5
1 changed files with 2 additions and 2 deletions
|
@ -2555,7 +2555,7 @@ int security_get_classes(char ***classes, int *nclasses)
|
||||||
read_lock(&policy_rwlock);
|
read_lock(&policy_rwlock);
|
||||||
|
|
||||||
*nclasses = policydb.p_classes.nprim;
|
*nclasses = policydb.p_classes.nprim;
|
||||||
*classes = kcalloc(*nclasses, sizeof(*classes), GFP_ATOMIC);
|
*classes = kcalloc(*nclasses, sizeof(**classes), GFP_ATOMIC);
|
||||||
if (!*classes)
|
if (!*classes)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
@ -2602,7 +2602,7 @@ int security_get_permissions(char *class, char ***perms, int *nperms)
|
||||||
}
|
}
|
||||||
|
|
||||||
*nperms = match->permissions.nprim;
|
*nperms = match->permissions.nprim;
|
||||||
*perms = kcalloc(*nperms, sizeof(*perms), GFP_ATOMIC);
|
*perms = kcalloc(*nperms, sizeof(**perms), GFP_ATOMIC);
|
||||||
if (!*perms)
|
if (!*perms)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue