[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250710150133.680679cf8a0f6b2f0bf3369f@linux-foundation.org>
Date: Thu, 10 Jul 2025 15:01:33 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Feng Tang <feng.tang@...ux.alibaba.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 1/1] panic: Fix compilation error (`make W=1`)
On Thu, 10 Jul 2025 12:48:16 +0300 Andy Shevchenko <andriy.shevchenko@...ux.intel.com> wrote:
> Compiler is not happy about the recently added code:
>
> 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";
> | ^~~~~~~~~~~~~~
>
> Fix it in the same way how, for example, lib/vsprintf.c does in the similar
> cases, i.e. by using string literal directly as sizeof() parameter.
>
> ...
>
> --- a/lib/sys_info.c
> +++ b/lib/sys_info.c
> @@ -49,13 +49,11 @@ 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";
> -
> int sysctl_sys_info_handler(const struct ctl_table *ro_table, int write,
> void *buffer, size_t *lenp,
> loff_t *ppos)
> {
> - char names[sizeof(sys_info_avail) + 1];
> + char names[sizeof("tasks,mem,timers,locks,ftrace,all_bt,blocked_tasks") + 1];
> struct ctl_table table;
> unsigned long *si_bits_global;
>
Yes, that's neater than the fix we currently have. I'll grab, thanks.
Powered by blists - more mailing lists