diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-01-15 07:30:20 -0500 |
---|---|---|
committer | Paul Moore <paul@paul-moore.com> | 2017-03-29 11:46:10 -0400 |
commit | 8ee4586ca5fe6c2a00f6a39f828f54c8f6cda472 (patch) | |
tree | fd5bd7864c18fe076fd0f3af9196146631cb65ce /security/selinux | |
parent | b380f783772eeb66a0da85549a85aadbe5f8e76d (diff) |
selinux: Adjust two checks for null pointers
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>
Diffstat (limited to 'security/selinux')
-rw-r--r-- | security/selinux/ss/sidtab.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/security/selinux/ss/sidtab.c b/security/selinux/ss/sidtab.c index c9533b21942b..f6915f257486 100644 --- a/security/selinux/ss/sidtab.c +++ b/security/selinux/ss/sidtab.c | |||
@@ -54,7 +54,7 @@ int sidtab_insert(struct sidtab *s, u32 sid, struct context *context) | |||
54 | } | 54 | } |
55 | 55 | ||
56 | newnode = kmalloc(sizeof(*newnode), GFP_ATOMIC); | 56 | newnode = kmalloc(sizeof(*newnode), GFP_ATOMIC); |
57 | if (newnode == NULL) { | 57 | if (!newnode) { |
58 | rc = -ENOMEM; | 58 | rc = -ENOMEM; |
59 | goto out; | 59 | goto out; |
60 | } | 60 | } |
@@ -98,7 +98,7 @@ static struct context *sidtab_search_core(struct sidtab *s, u32 sid, int force) | |||
98 | if (force && cur && sid == cur->sid && cur->context.len) | 98 | if (force && cur && sid == cur->sid && cur->context.len) |
99 | return &cur->context; | 99 | return &cur->context; |
100 | 100 | ||
101 | if (cur == NULL || sid != cur->sid || cur->context.len) { | 101 | if (!cur || sid != cur->sid || cur->context.len) { |
102 | /* Remap invalid SIDs to the unlabeled SID. */ | 102 | /* Remap invalid SIDs to the unlabeled SID. */ |
103 | sid = SECINITSID_UNLABELED; | 103 | sid = SECINITSID_UNLABELED; |
104 | hvalue = SIDTAB_HASH(sid); | 104 | hvalue = SIDTAB_HASH(sid); |