* [PATCH] sysctl: quiet unused variable warning in fs/proc/proc_sysctl.c:init_header()
@ 2026-09-18 6:23 Ethan Nelson-Moore
2026-09-18 11:05 ` Joel Granados
0 siblings, 1 reply; 4+ messages in thread
From: Ethan Nelson-Moore @ 2026-09-18 6:23 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Ethan Nelson-Moore, Kees Cook, Joel Granados
The init_header() function uses list_for_each_table_entry() without
using the entry argument. This causes a warning when building with W=1.
Since the code is correct, mark the associated variable as
__maybe_unused.
Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
---
fs/proc/proc_sysctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 04a382178c65..d0d76c31d330 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -206,7 +206,7 @@ static void init_header(struct ctl_table_header *head,
head->node = node;
INIT_HLIST_HEAD(&head->inodes);
if (node) {
- const struct ctl_table *entry;
+ const struct ctl_table *entry __maybe_unused;
list_for_each_table_entry(entry, head) {
node->header = head;
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] sysctl: quiet unused variable warning in fs/proc/proc_sysctl.c:init_header()
2026-09-18 6:23 [PATCH] sysctl: quiet unused variable warning in fs/proc/proc_sysctl.c:init_header() Ethan Nelson-Moore
@ 2026-09-18 11:05 ` Joel Granados
2026-09-19 22:58 ` Ethan Nelson-Moore
0 siblings, 1 reply; 4+ messages in thread
From: Joel Granados @ 2026-09-18 11:05 UTC (permalink / raw)
To: Ethan Nelson-Moore; +Cc: linux-fsdevel, Kees Cook
[-- Attachment #1: Type: text/plain, Size: 1156 bytes --]
On Thu, Sep 17, 2026 at 11:23:38PM -0700, Ethan Nelson-Moore wrote:
> The init_header() function uses list_for_each_table_entry() without
> using the entry argument. This causes a warning when building with W=1.
> Since the code is correct, mark the associated variable as
> __maybe_unused.
I'm probably compiling in a different way but I don't see that warning.
Can you please tell me how you compile, what are you are in. What
version of compiler are you running?
Thx
>
> Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
> ---
> fs/proc/proc_sysctl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
> index 04a382178c65..d0d76c31d330 100644
> --- a/fs/proc/proc_sysctl.c
> +++ b/fs/proc/proc_sysctl.c
> @@ -206,7 +206,7 @@ static void init_header(struct ctl_table_header *head,
> head->node = node;
> INIT_HLIST_HEAD(&head->inodes);
> if (node) {
> - const struct ctl_table *entry;
> + const struct ctl_table *entry __maybe_unused;
>
> list_for_each_table_entry(entry, head) {
> node->header = head;
> --
> 2.43.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sysctl: quiet unused variable warning in fs/proc/proc_sysctl.c:init_header()
2026-09-18 11:05 ` Joel Granados
@ 2026-09-19 22:58 ` Ethan Nelson-Moore
2026-09-25 10:26 ` Joel Granados
0 siblings, 1 reply; 4+ messages in thread
From: Ethan Nelson-Moore @ 2026-09-19 22:58 UTC (permalink / raw)
To: Joel Granados; +Cc: linux-fsdevel, Kees Cook
Hi, Joel,
On Fri, Sep 18, 2026 at 4:05 AM Joel Granados <joel.granados@kernel.org> wrote:
> I'm probably compiling in a different way but I don't see that warning.
> Can you please tell me how you compile, what are you are in. What
> version of compiler are you running?
I'm using GCC 16.2, which probably explains it, since newer GCC
versions have gotten more clever at detecting unused variables.
Ethan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sysctl: quiet unused variable warning in fs/proc/proc_sysctl.c:init_header()
2026-09-19 22:58 ` Ethan Nelson-Moore
@ 2026-09-25 10:26 ` Joel Granados
0 siblings, 0 replies; 4+ messages in thread
From: Joel Granados @ 2026-09-25 10:26 UTC (permalink / raw)
To: Ethan Nelson-Moore; +Cc: linux-fsdevel, Kees Cook
[-- Attachment #1: Type: text/plain, Size: 537 bytes --]
On Sat, Sep 19, 2026 at 03:58:43PM -0700, Ethan Nelson-Moore wrote:
> Hi, Joel,
>
> On Fri, Sep 18, 2026 at 4:05 AM Joel Granados <joel.granados@kernel.org> wrote:
> > I'm probably compiling in a different way but I don't see that warning.
> > Can you please tell me how you compile, what are you are in. What
> > version of compiler are you running?
>
> I'm using GCC 16.2, which probably explains it, since newer GCC
> versions have gotten more clever at detecting unused variables.
I'll add it to sysctl-next
best
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-25 10:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-18 6:23 [PATCH] sysctl: quiet unused variable warning in fs/proc/proc_sysctl.c:init_header() Ethan Nelson-Moore
2026-09-18 11:05 ` Joel Granados
2026-09-19 22:58 ` Ethan Nelson-Moore
2026-09-25 10:26 ` Joel Granados
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox