LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH] capabilities: use logical OR
@ 2023-05-29 22:54 Min-Hua Chen
  2023-05-30 14:05 ` David Laight
  0 siblings, 1 reply; 2+ messages in thread
From: Min-Hua Chen @ 2023-05-29 22:54 UTC (permalink / raw
  To: Serge Hallyn, Paul Moore, James Morris
  Cc: Min-Hua Chen, linux-security-module, linux-kernel

Use logical OR to fix the following sparse warnings:

security/commoncap.c:1358:41: sparse: warning: dubious: !x | y

No functional changes intended.

Signed-off-by: Min-Hua Chen <minhuadotchen@gmail.com>
---
 security/commoncap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/commoncap.c b/security/commoncap.c
index 0b3fc2f3afe7..b8e34f6204b2 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -1355,7 +1355,7 @@ int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3,
 			return commit_creds(new);
 		}
 
-		if (((!cap_valid(arg3)) | arg4 | arg5))
+		if (((!cap_valid(arg3)) || arg4 || arg5))
 			return -EINVAL;
 
 		if (arg2 == PR_CAP_AMBIENT_IS_SET) {
-- 
2.34.1


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

* RE: [PATCH] capabilities: use logical OR
  2023-05-29 22:54 [PATCH] capabilities: use logical OR Min-Hua Chen
@ 2023-05-30 14:05 ` David Laight
  0 siblings, 0 replies; 2+ messages in thread
From: David Laight @ 2023-05-30 14:05 UTC (permalink / raw
  To: 'Min-Hua Chen', Serge Hallyn, Paul Moore, James Morris
  Cc: linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org

From: Min-Hua Chen <minhuadotchen@gmail.com>
> Sent: 29 May 2023 23:55
> 
> Use logical OR to fix the following sparse warnings:
> 
> security/commoncap.c:1358:41: sparse: warning: dubious: !x | y
> 
> No functional changes intended.

Except it will run just that teeny, weeny bit slower.

	David

> Signed-off-by: Min-Hua Chen <minhuadotchen@gmail.com>
> ---
>  security/commoncap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/security/commoncap.c b/security/commoncap.c
> index 0b3fc2f3afe7..b8e34f6204b2 100644
> --- a/security/commoncap.c
> +++ b/security/commoncap.c
> @@ -1355,7 +1355,7 @@ int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3,
>  			return commit_creds(new);
>  		}
> 
> -		if (((!cap_valid(arg3)) | arg4 | arg5))
> +		if (((!cap_valid(arg3)) || arg4 || arg5))
>  			return -EINVAL;
> 
>  		if (arg2 == PR_CAP_AMBIENT_IS_SET) {
> --
> 2.34.1

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


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

end of thread, other threads:[~2023-05-30 14:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-29 22:54 [PATCH] capabilities: use logical OR Min-Hua Chen
2023-05-30 14:05 ` David Laight

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 read-only IMAP folder(s) and NNTP newsgroup(s).