[PATCH 3/5] keys: Remove redundant assignments
Michal Orzel
michalorzel.eng at gmail.com
Thu Mar 31 17:33:56 UTC 2022
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 at 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
More information about the Linux-security-module-archive
mailing list