]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
selinux: Adjust two checks for null pointers
authorMarkus Elfring <elfring@users.sourceforge.net>
Sun, 15 Jan 2017 12:30:20 +0000 (13:30 +0100)
committerPaul Moore <paul@paul-moore.com>
Wed, 29 Mar 2017 15:46:10 +0000 (11:46 -0400)
The script "checkpatch.pl" pointed information out like the following.

Comparison to NULL could be written !…

Thus fix affected source code places.

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

index c9533b21942bbfc6b66c8b2d01bda069ab93693a..f6915f257486a4c3840af609a4dfa86b6cd65c63 100644 (file)
@@ -54,7 +54,7 @@ int sidtab_insert(struct sidtab *s, u32 sid, struct context *context)
        }
 
        newnode = kmalloc(sizeof(*newnode), GFP_ATOMIC);
-       if (newnode == NULL) {
+       if (!newnode) {
                rc = -ENOMEM;
                goto out;
        }
@@ -98,7 +98,7 @@ static struct context *sidtab_search_core(struct sidtab *s, u32 sid, int force)
        if (force && cur && sid == cur->sid && cur->context.len)
                return &cur->context;
 
-       if (cur == NULL || sid != cur->sid || cur->context.len) {
+       if (!cur || sid != cur->sid || cur->context.len) {
                /* Remap invalid SIDs to the unlabeled SID. */
                sid = SECINITSID_UNLABELED;
                hvalue = SIDTAB_HASH(sid);