* [PATCH][next] security: remove redundant assignment to variable rc
@ 2024-11-12 12:45 Colin Ian King
2024-11-12 13:32 ` Serge E. Hallyn
2025-01-05 2:52 ` [PATCH] " Paul Moore
0 siblings, 2 replies; 5+ messages in thread
From: Colin Ian King @ 2024-11-12 12:45 UTC (permalink / raw)
To: Paul Moore, James Morris, Serge E . Hallyn, linux-security-module
Cc: kernel-janitors, linux-kernel
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>
---
security/security.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/security/security.c b/security/security.c
index 09664e09fec9..6147f27ea92a 100644
--- a/security/security.c
+++ b/security/security.c
@@ -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;
--
2.39.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH][next] security: remove redundant assignment to variable rc
2024-11-12 12:45 [PATCH][next] security: remove redundant assignment to variable rc Colin Ian King
@ 2024-11-12 13:32 ` Serge E. Hallyn
2024-11-12 14:00 ` Dan Carpenter
2025-01-05 2:52 ` [PATCH] " Paul Moore
1 sibling, 1 reply; 5+ messages in thread
From: Serge E. Hallyn @ 2024-11-12 13:32 UTC (permalink / raw)
To: Colin Ian King
Cc: Paul Moore, James Morris, Serge E . Hallyn, linux-security-module,
kernel-janitors, linux-kernel
On Tue, Nov 12, 2024 at 12:45:32PM +0000, Colin Ian King 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_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>
(long as it doesn't go to stable :)
> ---
> security/security.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/security/security.c b/security/security.c
> index 09664e09fec9..6147f27ea92a 100644
> --- a/security/security.c
> +++ b/security/security.c
> @@ -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;
> --
> 2.39.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][next] security: remove redundant assignment to variable rc
2024-11-12 13:32 ` Serge E. Hallyn
@ 2024-11-12 14:00 ` Dan Carpenter
2025-01-05 2:54 ` Paul Moore
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2024-11-12 14:00 UTC (permalink / raw)
To: Serge E. Hallyn
Cc: Colin Ian King, Paul Moore, James Morris, linux-security-module,
kernel-janitors, linux-kernel
On Tue, Nov 12, 2024 at 07:32:24AM -0600, Serge E. Hallyn wrote:
> On Tue, Nov 12, 2024 at 12:45:32PM +0000, Colin Ian King 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_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>
>
> (long as it doesn't go to stable :)
>
There is a tag for fixes which would break stable.
Cc: <stable+noautosel@kernel.org> # reason goes here, and must be present
But this isn't a fix and it wouldn't break stable so probably that's not
appropriate.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] security: remove redundant assignment to variable rc
2024-11-12 12:45 [PATCH][next] security: remove redundant assignment to variable rc Colin Ian King
2024-11-12 13:32 ` Serge E. Hallyn
@ 2025-01-05 2:52 ` Paul Moore
1 sibling, 0 replies; 5+ messages in thread
From: Paul Moore @ 2025-01-05 2:52 UTC (permalink / raw)
To: Colin Ian King, James Morris, Serge E . Hallyn,
linux-security-module
Cc: kernel-janitors, linux-kernel
On Nov 12, 2024 Colin Ian King <colin.i.king@gmail.com> 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_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>
> ---
> security/security.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
Merged to lsm/dev, thanks.
--
paul-moore.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][next] security: remove redundant assignment to variable rc
2024-11-12 14:00 ` Dan Carpenter
@ 2025-01-05 2:54 ` Paul Moore
0 siblings, 0 replies; 5+ messages in thread
From: Paul Moore @ 2025-01-05 2:54 UTC (permalink / raw)
To: Dan Carpenter
Cc: Serge E. Hallyn, Colin Ian King, James Morris,
linux-security-module, kernel-janitors, linux-kernel
On Tue, Nov 12, 2024 at 9:00 AM Dan Carpenter <dan.carpenter@linaro.org> wrote:
> On Tue, Nov 12, 2024 at 07:32:24AM -0600, Serge E. Hallyn wrote:
> > On Tue, Nov 12, 2024 at 12:45:32PM +0000, Colin Ian King 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_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>
> >
> > (long as it doesn't go to stable :)
> >
>
> There is a tag for fixes which would break stable.
>
> Cc: <stable+noautosel@kernel.org> # reason goes here, and must be present
>
> But 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.
--
paul-moore.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-01-05 2:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-12 12:45 [PATCH][next] security: remove redundant assignment to variable rc Colin Ian King
2024-11-12 13:32 ` Serge E. Hallyn
2024-11-12 14:00 ` Dan Carpenter
2025-01-05 2:54 ` Paul Moore
2025-01-05 2:52 ` [PATCH] " Paul Moore
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).