linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: Michal Orzel <michalorzel.eng@gmail.com>,
	David Howells <dhowells@redhat.com>
Cc: James Morris <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	keyrings@vger.kernel.org, linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH 3/5] keys: Remove redundant assignments
Date: Sun, 3 Apr 2022 11:06:51 +0300	[thread overview]
Message-ID: <YklVm5HRM789++rp@kernel.org> (raw)
In-Reply-To: <20220331173358.40939-3-michalorzel.eng@gmail.com>

On Thu, Mar 31, 2022 at 07:33:56PM +0200, Michal Orzel wrote:
> Get rid of redundant assignments which end up in values not being
> read either because they are overwritten or the function ends.
> 
> Reported by clang-tidy [deadcode.DeadStores]
> 
> Signed-off-by: Michal Orzel <michalorzel.eng@gmail.com>
> ---
>  security/keys/process_keys.c | 1 -
>  security/keys/request_key.c  | 6 ++----
>  2 files changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
> index b5d5333ab330..8bdd6410f79a 100644
> --- a/security/keys/process_keys.c
> +++ b/security/keys/process_keys.c
> @@ -92,7 +92,6 @@ int look_up_user_keyrings(struct key **_user_keyring,
>  		return PTR_ERR(reg_keyring);
>  
>  	down_write(&user_ns->keyring_sem);
> -	ret = 0;
>  
>  	/* Get the user keyring.  Note that there may be one in existence
>  	 * already as it may have been pinned by a session, but the user_struct
> diff --git a/security/keys/request_key.c b/security/keys/request_key.c
> index 2da4404276f0..ad29023c9518 100644
> --- a/security/keys/request_key.c
> +++ b/security/keys/request_key.c
> @@ -116,7 +116,7 @@ static int call_sbin_request_key(struct key *authkey, void *aux)
>  {
>  	static char const request_key[] = "/sbin/request-key";
>  	struct request_key_auth *rka = get_request_key_auth(authkey);
> -	const struct cred *cred = current_cred();
> +	const struct cred *cred;
>  	key_serial_t prkey, sskey;
>  	struct key *key = rka->target_key, *keyring, *session, *user_session;
>  	char *argv[9], *envp[3], uid_str[12], gid_str[12];
> @@ -506,9 +506,7 @@ static struct key *construct_key_and_link(struct keyring_search_context *ctx,
>  			kdebug("cons failed");
>  			goto construction_failed;
>  		}
> -	} else if (ret == -EINPROGRESS) {
> -		ret = 0;
> -	} else {
> +	} else if (ret != -EINPROGRESS) {
>  		goto error_put_dest_keyring;
>  	}
>  
> -- 
> 2.25.1
> 


Acked-by: Jarkko Sakkinen <jarkko@kernel.org>

David: can you pick this?

BR, Jarkko

  reply	other threads:[~2022-04-03  8:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-31 17:33 [PATCH 1/5] apparmor: Remove redundant assignments Michal Orzel
2022-03-31 17:33 ` [PATCH 2/5] integrity: " Michal Orzel
2022-03-31 17:33 ` [PATCH 3/5] keys: " Michal Orzel
2022-04-03  8:06   ` Jarkko Sakkinen [this message]
2022-03-31 17:33 ` [PATCH 5/5] smack: " Michal Orzel
2022-03-31 18:44   ` Casey Schaufler

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=YklVm5HRM789++rp@kernel.org \
    --to=jarkko@kernel.org \
    --cc=dhowells@redhat.com \
    --cc=jmorris@namei.org \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=michalorzel.eng@gmail.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.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;
as well as URLs for NNTP newsgroup(s).