selinux: Improve another size determination in sens_read()
authorMarkus Elfring <elfring@users.sourceforge.net>
Sat, 14 Jan 2017 20:52:55 +0000 (21:52 +0100)
committerPaul Moore <paul@paul-moore.com>
Wed, 29 Mar 2017 14:51:09 +0000 (10:51 -0400)
Replace the specification of a data type by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/ss/policydb.c

index aa1ce7ce35243346c752db8976919163f30da972..4759c22d1ae6c3c79aa30bd371d46c09949bd80d 100644 (file)
@@ -1611,7 +1611,7 @@ static int sens_read(struct policydb *p, struct hashtab *h, void *fp)
                goto bad;
 
        rc = -ENOMEM;
-       levdatum->level = kmalloc(sizeof(struct mls_level), GFP_ATOMIC);
+       levdatum->level = kmalloc(sizeof(*levdatum->level), GFP_ATOMIC);
        if (!levdatum->level)
                goto bad;