* [PATCH] drm/i915/display: Avoid nonliteral printf format string
@ 2025-12-04 9:43 Arnd Bergmann
2025-12-04 10:26 ` Jani Nikula
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2025-12-04 9:43 UTC (permalink / raw)
To: Jani Nikula, Rodrigo Vivi, Joonas Lahtinen, Tvrtko Ursulin,
David Airlie, Simona Vetter, Mika Kahola
Cc: Arnd Bergmann, Ville Syrjälä, Ankit Nautiyal,
Suraj Kandpal, Jouni Högander, intel-gfx, intel-xe,
dri-devel, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
pipe_config_mismatch() takes a printf-style format string and arguments,
not a constant string, so this trigers -Wformat warnings when they are
not disabled:
drivers/gpu/drm/i915/display/intel_display.c: In function 'pipe_config_cx0pll_mismatch':
drivers/gpu/drm/i915/display/intel_display.c:4997:9: error: format not a string literal and no format arguments [-Werror=format-security]
4997 | pipe_config_mismatch(p, fastset, crtc, name, chipname);
| ^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/display/intel_display.c: In function 'pipe_config_lt_phy_pll_mismatch':
drivers/gpu/drm/i915/display/intel_display.c:5027:9: error: format not a string literal and no format arguments [-Werror=format-security]
5027 | pipe_config_mismatch(p, fastset, crtc, name, chipname);
| ^~~~~~~~~~~~~~~~~~~~
Use either the string literal or the trivial "%s" format so the compiler can
prove this to be used correctly.
Fixes: 45fe957ae769 ("drm/i915/display: Add compare config for MTL+ platforms")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/gpu/drm/i915/display/intel_display.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 7b4fd18c60e2..83025d5a4aa9 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -4987,7 +4987,7 @@ pipe_config_cx0pll_mismatch(struct drm_printer *p, bool fastset,
struct intel_display *display = to_intel_display(crtc);
char *chipname = a->use_c10 ? "C10" : "C20";
- pipe_config_mismatch(p, fastset, crtc, name, chipname);
+ pipe_config_mismatch(p, fastset, crtc, name, "%s", chipname);
drm_printf(p, "expected:\n");
intel_cx0pll_dump_hw_state(display, a);
@@ -5022,9 +5022,8 @@ pipe_config_lt_phy_pll_mismatch(struct drm_printer *p, bool fastset,
const struct intel_lt_phy_pll_state *b)
{
struct intel_display *display = to_intel_display(crtc);
- char *chipname = "LTPHY";
- pipe_config_mismatch(p, fastset, crtc, name, chipname);
+ pipe_config_mismatch(p, fastset, crtc, name, "LTPHY");
drm_printf(p, "expected:\n");
intel_lt_phy_dump_hw_state(display, a);
--
2.39.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/i915/display: Avoid nonliteral printf format string
2025-12-04 9:43 [PATCH] drm/i915/display: Avoid nonliteral printf format string Arnd Bergmann
@ 2025-12-04 10:26 ` Jani Nikula
0 siblings, 0 replies; 2+ messages in thread
From: Jani Nikula @ 2025-12-04 10:26 UTC (permalink / raw)
To: Arnd Bergmann, Rodrigo Vivi, Joonas Lahtinen, Tvrtko Ursulin,
David Airlie, Simona Vetter, Mika Kahola
Cc: Arnd Bergmann, Ville Syrjälä, Ankit Nautiyal,
Suraj Kandpal, Jouni Högander, intel-gfx, intel-xe,
dri-devel, linux-kernel
On Thu, 04 Dec 2025, Arnd Bergmann <arnd@kernel.org> wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> pipe_config_mismatch() takes a printf-style format string and arguments,
> not a constant string, so this trigers -Wformat warnings when they are
> not disabled:
>
> drivers/gpu/drm/i915/display/intel_display.c: In function 'pipe_config_cx0pll_mismatch':
> drivers/gpu/drm/i915/display/intel_display.c:4997:9: error: format not a string literal and no format arguments [-Werror=format-security]
> 4997 | pipe_config_mismatch(p, fastset, crtc, name, chipname);
> | ^~~~~~~~~~~~~~~~~~~~
>
> drivers/gpu/drm/i915/display/intel_display.c: In function 'pipe_config_lt_phy_pll_mismatch':
> drivers/gpu/drm/i915/display/intel_display.c:5027:9: error: format not a string literal and no format arguments [-Werror=format-security]
> 5027 | pipe_config_mismatch(p, fastset, crtc, name, chipname);
> | ^~~~~~~~~~~~~~~~~~~~
>
> Use either the string literal or the trivial "%s" format so the compiler can
> prove this to be used correctly.
>
> Fixes: 45fe957ae769 ("drm/i915/display: Add compare config for MTL+ platforms")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Unfortunately, this no longer applies to
drm-intel-next. pipe_config_cx0pll_mismatch() no longer exists. The 2nd
hunk is still valid, though, want to send a rebased version?
BR,
Jani.
> ---
> drivers/gpu/drm/i915/display/intel_display.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 7b4fd18c60e2..83025d5a4aa9 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -4987,7 +4987,7 @@ pipe_config_cx0pll_mismatch(struct drm_printer *p, bool fastset,
> struct intel_display *display = to_intel_display(crtc);
> char *chipname = a->use_c10 ? "C10" : "C20";
>
> - pipe_config_mismatch(p, fastset, crtc, name, chipname);
> + pipe_config_mismatch(p, fastset, crtc, name, "%s", chipname);
>
> drm_printf(p, "expected:\n");
> intel_cx0pll_dump_hw_state(display, a);
> @@ -5022,9 +5022,8 @@ pipe_config_lt_phy_pll_mismatch(struct drm_printer *p, bool fastset,
> const struct intel_lt_phy_pll_state *b)
> {
> struct intel_display *display = to_intel_display(crtc);
> - char *chipname = "LTPHY";
>
> - pipe_config_mismatch(p, fastset, crtc, name, chipname);
> + pipe_config_mismatch(p, fastset, crtc, name, "LTPHY");
>
> drm_printf(p, "expected:\n");
> intel_lt_phy_dump_hw_state(display, a);
--
Jani Nikula, Intel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-12-04 10:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-04 9:43 [PATCH] drm/i915/display: Avoid nonliteral printf format string Arnd Bergmann
2025-12-04 10:26 ` Jani Nikula
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox