[PATCH 4/6] security: fix ptr_ret.cocci warnings

Matthew Garrett matthewgarrett at google.com
Tue Aug 13 19:21:24 UTC 2019


From: kbuild test robot <lkp at intel.com>

security/lockdown/lockdown.c:157:1-3: WARNING: PTR_ERR_OR_ZERO can be used

 Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Fixes: 80d14015a8e3 ("security: Add a static lockdown policy LSM")
Signed-off-by: kbuild test robot <lkp at intel.com>
Signed-off-by: Matthew Garrett <matthewgarrett at google.com>
---
 security/lockdown/lockdown.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/security/lockdown/lockdown.c b/security/lockdown/lockdown.c
index f6c74cf6a798..0068cec77c05 100644
--- a/security/lockdown/lockdown.c
+++ b/security/lockdown/lockdown.c
@@ -176,10 +176,7 @@ static int __init lockdown_secfs_init(void)
 
 	dentry = securityfs_create_file("lockdown", 0600, NULL, NULL,
 					&lockdown_ops);
-	if (IS_ERR(dentry))
-		return PTR_ERR(dentry);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(dentry);
 }
 
 core_initcall(lockdown_secfs_init);
-- 
2.23.0.rc1.153.gdeed80330f-goog



More information about the Linux-security-module-archive mailing list