security: remove redundant assignment to variable rc
Subsystems (2)
PATCH 1/1 security: remove redundant assignment to variable rc
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.
--- security/security.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
security/security.c +1 -3
@@ -4139,10 +4139,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 ;
Signature · 1 line
2.39.5
Quoted 7 lines · Colin Ian King
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_hookloop 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 <[email protected]>
(long as it doesn't go to stable :)
Quoted 22 lines
--- security/security.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)security/security.c +1
-3@@ -4139,10 +4139,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 ;Signature · 1 line
2.39.5
Quoted 7 lines · Serge E. Hallyn
Quoted 6 lines · Colin Ian King
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_hookloop and rc is being re-assigned a new value from the call to getselfattr. The assignment is redundant and can be removed.
Quoted 6 lines
Quoted 1 line
Signed-off-by Colin Ian King <[email protected]>Reviewed-by Serge Hallyn <[email protected]>(long as it doesn't go to stable :)
There is a tag for fixes which would break stable.
But this isn't a fix and it wouldn't break stable so probably that's not appropriate.
regards,
dan carpenter
Paul Moore
maintainerQuoted 15 lines · Dan Carpenter
Quoted 7 lines · Serge E. Hallyn
Quoted 6 lines · Colin Ian King
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_hookloop and rc is being re-assigned a new value from the call to getselfattr. The assignment is redundant and can be removed.Quoted 6 lines
Quoted 1 line
Signed-off-by Colin Ian King <[email protected]>Reviewed-by Serge Hallyn <[email protected]>(long as it doesn't go to stable :)
Quoted 6 lines
There is a tag for fixes which would break stable.
Cc <[email protected]> # reason goes here, and must be presentBut this isn't a fix and it wouldn't break stable so probably that's not appropriate.
I've also talked with the stable kernel folks and they no longer automatically pull any LSM commits with a 'Fixes:' tag. LSM commits need to be explicitly marked with the stable CC for them to be pulled into the stable trees.
Signature · 1 line
paul-moore.com
Quoted 7 lines · On Nov 12, 2024 Colin Ian King <[email protected]> wrote:
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_hookloop and rc is being re-assigned a new value from the call to getselfattr. The assignment is redundant and can be removed.
Quoted 5 lines
Signed-off-by Colin Ian King <[email protected]>Reviewed-by Serge Hallyn <[email protected]>--- security/security.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
Merged to lsm/dev, thanks.
--
paul-moore.com