mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
selinux: Adjust four 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>
This commit is contained in:
parent
2f00e680fe
commit
cb8d21e364
1 changed files with 4 additions and 4 deletions
|
@ -17,7 +17,7 @@ struct hashtab *hashtab_create(u32 (*hash_value)(struct hashtab *h, const void *
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
p = kzalloc(sizeof(*p), GFP_KERNEL);
|
p = kzalloc(sizeof(*p), GFP_KERNEL);
|
||||||
if (p == NULL)
|
if (!p)
|
||||||
return p;
|
return p;
|
||||||
|
|
||||||
p->size = size;
|
p->size = size;
|
||||||
|
@ -25,7 +25,7 @@ struct hashtab *hashtab_create(u32 (*hash_value)(struct hashtab *h, const void *
|
||||||
p->hash_value = hash_value;
|
p->hash_value = hash_value;
|
||||||
p->keycmp = keycmp;
|
p->keycmp = keycmp;
|
||||||
p->htable = kmalloc_array(size, sizeof(*p->htable), GFP_KERNEL);
|
p->htable = kmalloc_array(size, sizeof(*p->htable), GFP_KERNEL);
|
||||||
if (p->htable == NULL) {
|
if (!p->htable) {
|
||||||
kfree(p);
|
kfree(p);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ int hashtab_insert(struct hashtab *h, void *key, void *datum)
|
||||||
return -EEXIST;
|
return -EEXIST;
|
||||||
|
|
||||||
newnode = kzalloc(sizeof(*newnode), GFP_KERNEL);
|
newnode = kzalloc(sizeof(*newnode), GFP_KERNEL);
|
||||||
if (newnode == NULL)
|
if (!newnode)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
newnode->key = key;
|
newnode->key = key;
|
||||||
newnode->datum = datum;
|
newnode->datum = datum;
|
||||||
|
@ -87,7 +87,7 @@ void *hashtab_search(struct hashtab *h, const void *key)
|
||||||
while (cur && h->keycmp(h, key, cur->key) > 0)
|
while (cur && h->keycmp(h, key, cur->key) > 0)
|
||||||
cur = cur->next;
|
cur = cur->next;
|
||||||
|
|
||||||
if (cur == NULL || (h->keycmp(h, key, cur->key) != 0))
|
if (!cur || (h->keycmp(h, key, cur->key) != 0))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return cur->datum;
|
return cur->datum;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue