Linux Security Modules development
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Min-Hua Chen' <minhuadotchen@gmail.com>,
	Serge Hallyn <serge@hallyn.com>, Paul Moore <paul@paul-moore.com>,
	James Morris <jmorris@namei.org>
Cc: "linux-security-module@vger.kernel.org" 
	<linux-security-module@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] capabilities: use logical OR
Date: Tue, 30 May 2023 14:05:48 +0000	[thread overview]
Message-ID: <db536b16e33648fdb44629fc9c1c1afc@AcuMS.aculab.com> (raw)
In-Reply-To: <20230529225440.7315-1-minhuadotchen@gmail.com>

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)


      reply	other threads:[~2023-05-30 14:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-29 22:54 [PATCH] capabilities: use logical OR Min-Hua Chen
2023-05-30 14:05 ` David Laight [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=db536b16e33648fdb44629fc9c1c1afc@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=minhuadotchen@gmail.com \
    --cc=paul@paul-moore.com \
    --cc=serge@hallyn.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox