[PATCH 6/7] security: apparmor: apparmorfs.c Comparison to NULL

Walt Feasel waltfeasel at gmail.com
Sat Nov 26 03:43:24 EST 2016


Make style modifications for:
CHECK: Comparison to NULL could be written "!data"

Signed-off-by: Walt Feasel <waltfeasel at gmail.com>
---
My first patch of this type checking if
this would be correct

 security/apparmor/apparmorfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index c8142cf..c3fff95 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -102,7 +102,7 @@ static char *aa_simple_write_to_buffer(int op, const char __user *userbuf,
 
 	/* freed by caller to simple_write_to_buffer */
 	data = kvmalloc(alloc_size);
-	if (data == NULL)
+	if (!data)
 		return ERR_PTR(-ENOMEM);
 
 	if (copy_from_user(data, userbuf, copy_size)) {
-- 
2.1.4




More information about the Kernelnewbies mailing list