]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
selinux: Remove redundant assignments
authorMichal Orzel <michalorzel.eng@gmail.com>
Thu, 31 Mar 2022 17:33:57 +0000 (19:33 +0200)
committerPaul Moore <paul@paul-moore.com>
Mon, 4 Apr 2022 19:38:53 +0000 (15:38 -0400)
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>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/avc.c
security/selinux/hooks.c
security/selinux/ss/services.c

index abcd9740d10f0cf12a58106b6fac44a6f003197e..874c1c6fe10b14ac6a286eb5665c5fc6c6295ad2 100644 (file)
@@ -1059,7 +1059,7 @@ int avc_has_extended_perms(struct selinux_state *state,
 
        node = avc_lookup(state->avc, ssid, tsid, tclass);
        if (unlikely(!node)) {
-               node = avc_compute_av(state, ssid, tsid, tclass, &avd, xp_node);
+               avc_compute_av(state, ssid, tsid, tclass, &avd, xp_node);
        } else {
                memcpy(&avd, &node->ae.avd, sizeof(avd));
                xp_node = node->ae.xp_node;
@@ -1151,7 +1151,7 @@ inline int avc_has_perm_noaudit(struct selinux_state *state,
 
        node = avc_lookup(state->avc, ssid, tsid, tclass);
        if (unlikely(!node))
-               node = avc_compute_av(state, ssid, tsid, tclass, avd, &xp_node);
+               avc_compute_av(state, ssid, tsid, tclass, avd, &xp_node);
        else
                memcpy(avd, &node->ae.avd, sizeof(*avd));
 
index e9e959343de98db83a35d8b0592fe4129dc5a0c1..f792835b3fb6460a6176cbccfe6f08cfc75acb41 100644 (file)
@@ -6487,7 +6487,6 @@ static int selinux_setprocattr(const char *name, void *value, size_t size)
                        goto abort_change;
 
                /* Only allow single threaded processes to change context */
-               error = -EPERM;
                if (!current_is_single_threaded()) {
                        error = security_bounded_transition(&selinux_state,
                                                            tsec->sid, sid);
index 6901dc07680de727bc924b9054d87492972b56f0..802a80648c6c06729832f5b0e9266cf8df6a5a58 100644 (file)
@@ -2980,7 +2980,6 @@ int security_fs_use(struct selinux_state *state, struct super_block *sb)
        }
 
 retry:
-       rc = 0;
        rcu_read_lock();
        policy = rcu_dereference(state->policy);
        policydb = &policy->policydb;