Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Arnd Bergmann <arnd@kernel.org>,
	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: Re: [PATCH] drm/i915/display: Avoid nonliteral printf format string
Date: Thu, 04 Dec 2025 12:26:34 +0200	[thread overview]
Message-ID: <7579ed96424f51f171bee13f387f68c96f2d8a62@intel.com> (raw)
In-Reply-To: <20251204094401.1029917-1-arnd@kernel.org>

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

      reply	other threads:[~2025-12-04 10:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-04  9:43 [PATCH] drm/i915/display: Avoid nonliteral printf format string Arnd Bergmann
2025-12-04 10:26 ` Jani Nikula [this message]

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=7579ed96424f51f171bee13f387f68c96f2d8a62@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=airlied@gmail.com \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --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