]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
security: remove redundant assignment to return variable
authorColin Ian King <colin.i.king@gmail.com>
Tue, 12 Nov 2024 12:45:32 +0000 (12:45 +0000)
committerPaul Moore <paul@paul-moore.com>
Sun, 5 Jan 2025 02:52:13 +0000 (21:52 -0500)
In the case where rc is equal to EOPNOTSUPP it is being reassigned a
new value of zero that is never read. The following continue statement
loops back to the next iteration of the lsm_for_each_hook loop and
rc is being re-assigned a new value from the call to getselfattr.
The assignment is redundant and can be removed.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Reviewed-by: Serge Hallyn <serge@hallyn.com>
[PM: subj tweak]
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/security.c

index 7523d14f31fb11a028ae66063e7da952ea19755d..39df4451455bcdcbdc3888f0441035483da39918 100644 (file)
@@ -4138,10 +4138,8 @@ int security_getselfattr(unsigned int attr, struct lsm_ctx __user *uctx,
                if (base)
                        uctx = (struct lsm_ctx __user *)(base + total);
                rc = scall->hl->hook.getselfattr(attr, uctx, &entrysize, flags);
-               if (rc == -EOPNOTSUPP) {
-                       rc = 0;
+               if (rc == -EOPNOTSUPP)
                        continue;
-               }
                if (rc == -E2BIG) {
                        rc = 0;
                        left = 0;