Re: [PATCH] kdb: address -Wformat-security warnings

From: Doug Anderson
Date: Tue May 28 2024 - 09:42:12 EST


Hi,

On Tue, May 28, 2024 at 5:12 AM Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
>
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> When -Wformat-security is not disabled, using a string pointer
> as a format causes a warning:
>
> kernel/debug/kdb/kdb_io.c: In function 'kdb_read':
> kernel/debug/kdb/kdb_io.c:365:36: error: format not a string literal and no format arguments [-Werror=format-security]
> 365 | kdb_printf(kdb_prompt_str);
> | ^~~~~~~~~~~~~~
> kernel/debug/kdb/kdb_io.c: In function 'kdb_getstr':
> kernel/debug/kdb/kdb_io.c:456:20: error: format not a string literal and no format arguments [-Werror=format-security]
> 456 | kdb_printf(kdb_prompt_str);
> | ^~~~~~~~~~~~~~
>
> Use an explcit "%s" format instead.
>
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> ---
> kernel/debug/kdb/kdb_io.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)

Fixes: 5d5314d6795f ("kdb: core for kgdb back end (1 of 2)")
Reviewed-by: Douglas Anderson <dianders@xxxxxxxxxxxx>

..probably also justifies a:

Cc: stable@xxxxxxxxxxxxxxx


-Doug