The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Dakkshesh <beakthoven@gmail.com>
To: gregkh@linuxfoundation.org
Cc: stable@vger.kernel.org, linux-kernel@vger.kernel.org,
	Dakkshesh <beakthoven@gmail.com>
Subject: [PATCH] scripts/sorttable: guard long_size under MCOUNT_SORT_ENABLED
Date: Thu,  4 Jun 2026 00:47:08 +0530	[thread overview]
Message-ID: <20260603191708.27241-1-beakthoven@gmail.com> (raw)

clang's -Wunused-but-set-global (a sub-warning of
-Wunused-but-set-variable, enabled via -Wall), points out an
unused static global variable in scripts/sorttable.c:

scripts/sorttable.c:452:12: error: variable 'long_size' set but not
  used [-Werror,-Wunused-but-set-variable]

long_size is only read inside MCOUNT_SORT_ENABLED blocks. In upstream,
it is implicitly resolved by commit b055f4c431e3 ("sorttable: Move ELF
parsing into scripts/elf-parse.[ch]") which refactors the file entirely.

Cc: stable@vger.kernel.org
Signed-off-by: Dakkshesh <beakthoven@gmail.com>
---
 scripts/sorttable.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/scripts/sorttable.c b/scripts/sorttable.c
index deed676bf..674b24a97 100644
--- a/scripts/sorttable.c
+++ b/scripts/sorttable.c
@@ -449,7 +449,9 @@ static inline void *get_index(void *start, int entsize, int index)
 }
 
 static int extable_ent_size;
+#ifdef MCOUNT_SORT_ENABLED
 static int long_size;
+#endif
 
 #define ERRSTR_MAXSZ	256
 
@@ -1311,7 +1313,9 @@ static int do_file(char const *const fname, void *addr)
 		};
 
 		e = efuncs;
+#ifdef MCOUNT_SORT_ENABLED
 		long_size		= 4;
+#endif
 		extable_ent_size	= 8;
 
 		if (r2(&ehdr->e32.e_ehsize) != sizeof(Elf32_Ehdr) ||
@@ -1348,7 +1352,9 @@ static int do_file(char const *const fname, void *addr)
 		};
 
 		e = efuncs;
+#ifdef MCOUNT_SORT_ENABLED
 		long_size		= 8;
+#endif
 		extable_ent_size	= 16;
 
 		if (r2(&ehdr->e64.e_ehsize) != sizeof(Elf64_Ehdr) ||
-- 
2.54.0


             reply	other threads:[~2026-06-03 19:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03 19:17 Dakkshesh [this message]
2026-07-10  0:22 ` [PATCH] scripts/sorttable: guard long_size under MCOUNT_SORT_ENABLED Nathan Chancellor

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=20260603191708.27241-1-beakthoven@gmail.com \
    --to=beakthoven@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@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