lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250708-fix-clang-sys_info_avail-warning-v1-1-60d239eacd64@kernel.org>
Date: Tue, 08 Jul 2025 08:37:57 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Feng Tang <feng.tang@...ux.alibaba.com>, 
 Lance Yang <lance.yang@...ux.dev>, Petr Mladek <pmladek@...e.com>, 
 linux-kernel@...r.kernel.org, llvm@...ts.linux.dev, 
 Nathan Chancellor <nathan@...nel.org>
Subject: [PATCH] panic: Add __maybe_unused to sys_info_avail

Clang warns (or errors with CONFIG_WERROR=y):

  lib/sys_info.c:52:19: error: variable 'sys_info_avail' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
     52 | static const char sys_info_avail[] = "tasks,mem,timers,locks,ftrace,all_bt,blocked_tasks";
        |                   ^~~~~~~~~~~~~~

sys_info_avail is only used within sizeof(), meaning it is only used at
compile time, which clang warns about in case the developer intended to
use the variable elsewhere. This appears to be intentional in this case,
so mark sys_info_avail with __maybe_unused to silence the warning.

Signed-off-by: Nathan Chancellor <nathan@...nel.org>
---
This should be squashed into
panic-add-panic_sys_info-sysctl-to-take-human-readable-string-parameter.patch
so I did not bother with a fixes tag.
---
 lib/sys_info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/sys_info.c b/lib/sys_info.c
index 46d6f4f1ad2a..5bf503fd7ec1 100644
--- a/lib/sys_info.c
+++ b/lib/sys_info.c
@@ -49,7 +49,7 @@ unsigned long sys_info_parse_param(char *str)
 
 #ifdef CONFIG_SYSCTL
 
-static const char sys_info_avail[] = "tasks,mem,timers,locks,ftrace,all_bt,blocked_tasks";
+static const char sys_info_avail[] __maybe_unused = "tasks,mem,timers,locks,ftrace,all_bt,blocked_tasks";
 
 int sysctl_sys_info_handler(const struct ctl_table *ro_table, int write,
 					  void *buffer, size_t *lenp,

---
base-commit: 10f2351db2799f80af91da7aee4c60fd042bfcf3
change-id: 20250708-fix-clang-sys_info_avail-warning-fa19cdd77b71

Best regards,
--  
Nathan Chancellor <nathan@...nel.org>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ