linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] security: fix ptr_ret.cocci warnings
  2019-08-10  6:58 [security:next-lockdown 3/29] security/lockdown/lockdown.c:157:1-3: WARNING: PTR_ERR_OR_ZERO can be used kbuild test robot
@ 2019-08-10  6:58 ` kbuild test robot
  2019-08-12 18:00   ` Kees Cook
  0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2019-08-10  6:58 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: kbuild-all, linux-security-module, James Morris, Kees Cook

From: kbuild test robot <lkp@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@google.com>
Signed-off-by: kbuild test robot <lkp@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);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [security:next-lockdown 3/29] security/lockdown/lockdown.c:157:1-3: WARNING: PTR_ERR_OR_ZERO can be used
@ 2019-08-10  6:58 kbuild test robot
  2019-08-10  6:58 ` [PATCH] security: fix ptr_ret.cocci warnings kbuild test robot
  0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2019-08-10  6:58 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: kbuild-all, linux-security-module, James Morris, Kees Cook

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

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>


coccinelle warnings: (new ones prefixed by >>)

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

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] security: fix ptr_ret.cocci warnings
  2019-08-10  6:58 ` [PATCH] security: fix ptr_ret.cocci warnings kbuild test robot
@ 2019-08-12 18:00   ` Kees Cook
  0 siblings, 0 replies; 3+ messages in thread
From: Kees Cook @ 2019-08-12 18:00 UTC (permalink / raw)
  To: kbuild test robot
  Cc: Matthew Garrett, kbuild-all, linux-security-module, James Morris

On Sat, Aug 10, 2019 at 02:58:46PM +0800, kbuild test robot wrote:
> From: kbuild test robot <lkp@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@google.com>
> Signed-off-by: kbuild test robot <lkp@intel.com>

Acked-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
> 
> 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);

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-08-12 18:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-10  6:58 [security:next-lockdown 3/29] security/lockdown/lockdown.c:157:1-3: WARNING: PTR_ERR_OR_ZERO can be used kbuild test robot
2019-08-10  6:58 ` [PATCH] security: fix ptr_ret.cocci warnings kbuild test robot
2019-08-12 18:00   ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).