[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YklVm5HRM789++rp@kernel.org>
Date: Sun, 3 Apr 2022 11:06:51 +0300
From: Jarkko Sakkinen <jarkko@...nel.org>
To: Michal Orzel <michalorzel.eng@...il.com>,
David Howells <dhowells@...hat.com>
Cc: James Morris <jmorris@...ei.org>,
"Serge E. Hallyn" <serge@...lyn.com>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
keyrings@...r.kernel.org, linux-security-module@...r.kernel.org,
linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH 3/5] keys: Remove redundant assignments
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@...il.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@...nel.org>
David: can you pick this?
BR, Jarkko
Powered by blists - more mailing lists