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-prev] [day] [month] [year] [list]
Message-ID: <aG3Ew-EB-T0hiOt2@U-2FWC9VHC-2323.local>
Date: Wed, 9 Jul 2025 09:24:19 +0800
From: Feng Tang <feng.tang@...ux.alibaba.com>
To: Nathan Chancellor <nathan@...nel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
	Lance Yang <lance.yang@...ux.dev>, Petr Mladek <pmladek@...e.com>,
	linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH] panic: Add __maybe_unused to sys_info_avail

On Tue, Jul 08, 2025 at 08:37:57AM -0700, Nathan Chancellor wrote:
> 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.

Looks good to me. Thanks for the fix!

- Feng

> ---
>  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