Skip to content

Commit

Permalink
selinux: Adjust two checks for null pointers
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Paul Moore <[email protected]>
  • Loading branch information
elfring authored and pcmoore committed Mar 29, 2017
1 parent b380f78 commit 8ee4586
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions security/selinux/ss/sidtab.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 8ee4586

Please sign in to comment.