[PATCH] security: fix ptr_ret.cocci warnings

kbuild test robot lkp at intel.com
Sat Aug 10 06:58:46 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")
CC: Matthew Garrett <matthewgarrett at google.com>
Signed-off-by: kbuild test robot <lkp at intel.com>
---

tree:   https://kernel.googlesource.com/pub/scm/linux/kernel/git/jmorris/linux-security.git next-lockdown
head:   05ef41e93e1a40d6b2d9846284824ec6f67fe422
commit: 80d14015a8e3109f9b5e3e39b0bc78e1c3a1f315 [3/29] security: Add a static lockdown policy LSM

 lockdown.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

--- a/security/lockdown/lockdown.c
+++ b/security/lockdown/lockdown.c
@@ -154,10 +154,7 @@ static int __init lockdown_secfs_init(vo
 
 	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);



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