mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Safety 1 <git.userk@gmail.com>
To: kees@kernel.org
Cc: joel.granados@kernel.org, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org,
	Safety 1 <176830914+JokerPython3@users.noreply.github.com>
Subject: [PATCH] fs/proc: avoid unused ctl_table entry in init_header
Date: Wed,  9 Sep 2026 19:32:14 +0300	[thread overview]
Message-ID: <20260909163214.245399-1-176830914+JokerPython3@users.noreply.github.com> (raw)

The entry variable in init_header() is only used by
list_for_each_table_entry() for iteration and is never read. With
-Werror=unused-but-set-variable, this causes the build to fail.

Use the table size directly for the loop since the entry value is
not needed here.

Tested with: make -j$(nproc)
Signed-off-by: Safety 1 <176830914+JokerPython3@users.noreply.github.com>
---
 fs/proc/proc_sysctl.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 04a382178..ddc510def 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -206,9 +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;
-
-		list_for_each_table_entry(entry, head) {
+		for (size_t i = 0; i < head->ctl_table_size; i++) {
 			node->header = head;
 			node++;
 		}

base-commit: 893e11787f78e43b534e252249ac3fff4d1333f8
-- 
2.55.0


                 reply	other threads:[~2026-09-09 16:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260909163214.245399-1-176830914+JokerPython3@users.noreply.github.com \
    --to=git.userk@gmail.com \
    --cc=176830914+JokerPython3@users.noreply.github.com \
    --cc=joel.granados@kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®