lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 07 Dec 2009 10:02:23 -0500
From:	Eric Paris <eparis@...hat.com>
To:	Julia Lawall <julia@...u.dk>
Cc:	Stephen Smalley <sds@...ho.nsa.gov>,
	James Morris <jmorris@...ei.org>,
	linux-security-module@...r.kernel.org,
	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 5/5] security/selinux/ss: correct size computation

On Sun, 2009-12-06 at 10:16 +0100, Julia Lawall wrote:
> From: Julia Lawall <julia@...u.dk>
> 
> 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@...u.dk>

Acked-by: Eric Paris <eparis@...hat.com>

no real hurry, to get this in, the sizeof() is the same in either case,
but it should be fixed.


> 
> ---
>  security/selinux/ss/services.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff -u -p a/security/selinux/ss/services.c b/security/selinux/ss/services.c
> --- a/security/selinux/ss/services.c
> +++ b/security/selinux/ss/services.c
> @@ -2555,7 +2555,7 @@ int security_get_classes(char ***classes
>  	read_lock(&policy_rwlock);
>  
>  	*nclasses = policydb.p_classes.nprim;
> -	*classes = kcalloc(*nclasses, sizeof(*classes), GFP_ATOMIC);
> +	*classes = kcalloc(*nclasses, sizeof(**classes), GFP_ATOMIC);
>  	if (!*classes)
>  		goto out;
>  
> @@ -2602,7 +2602,7 @@ int security_get_permissions(char *class
>  	}
>  
>  	*nperms = match->permissions.nprim;
> -	*perms = kcalloc(*nperms, sizeof(*perms), GFP_ATOMIC);
> +	*perms = kcalloc(*nperms, sizeof(**perms), GFP_ATOMIC);
>  	if (!*perms)
>  		goto out;
>  


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ