intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Jani Nikula <jani.nikula@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Tvrtko Ursulin <tursulin@ursulin.net>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Mika Kahola <mika.kahola@intel.com>
Cc: "Arnd Bergmann" <arnd@arndb.de>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"Ankit Nautiyal" <ankit.k.nautiyal@intel.com>,
	"Suraj Kandpal" <suraj.kandpal@intel.com>,
	"Jouni Högander" <jouni.hogander@intel.com>,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH] drm/i915/display: Avoid nonliteral printf format string
Date: Thu,  4 Dec 2025 10:43:51 +0100	[thread overview]
Message-ID: <20251204094401.1029917-1-arnd@kernel.org> (raw)

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


             reply	other threads:[~2025-12-04  9:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-04  9:43 Arnd Bergmann [this message]
2025-12-04  9:56 ` ✗ Fi.CI.BUILD: failure for drm/i915/display: Avoid nonliteral printf format string Patchwork
2025-12-04 10:26 ` [PATCH] " Jani Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251204094401.1029917-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=airlied@gmail.com \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=arnd@arndb.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=jouni.hogander@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.kahola@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=simona@ffwll.ch \
    --cc=suraj.kandpal@intel.com \
    --cc=tursulin@ursulin.net \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).