mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
kdb: address -Wformat-security warnings
[ Upstream commit 70867efacf4370b6c7cdfc7a5b11300e9ef7de64 ]
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@arndb.de>
Fixes: 5d5314d679 ("kdb: core for kgdb back end (1 of 2)")
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20240528121154.3662553-1-arnd@kernel.org
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
139faad888
commit
fa278a24cb
@@ -357,7 +357,7 @@ poll_again:
|
|||||||
if (i >= dtab_count)
|
if (i >= dtab_count)
|
||||||
kdb_printf("...");
|
kdb_printf("...");
|
||||||
kdb_printf("\n");
|
kdb_printf("\n");
|
||||||
kdb_printf(kdb_prompt_str);
|
kdb_printf("%s", kdb_prompt_str);
|
||||||
kdb_printf("%s", buffer);
|
kdb_printf("%s", buffer);
|
||||||
if (cp != lastchar)
|
if (cp != lastchar)
|
||||||
kdb_position_cursor(kdb_prompt_str, buffer, cp);
|
kdb_position_cursor(kdb_prompt_str, buffer, cp);
|
||||||
@@ -449,7 +449,7 @@ char *kdb_getstr(char *buffer, size_t bufsize, const char *prompt)
|
|||||||
{
|
{
|
||||||
if (prompt && kdb_prompt_str != prompt)
|
if (prompt && kdb_prompt_str != prompt)
|
||||||
strscpy(kdb_prompt_str, prompt, CMD_BUFLEN);
|
strscpy(kdb_prompt_str, prompt, CMD_BUFLEN);
|
||||||
kdb_printf(kdb_prompt_str);
|
kdb_printf("%s", kdb_prompt_str);
|
||||||
kdb_nextline = 1; /* Prompt and input resets line number */
|
kdb_nextline = 1; /* Prompt and input resets line number */
|
||||||
return kdb_read(buffer, bufsize);
|
return kdb_read(buffer, bufsize);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user