All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] drm: use drm_warn() in validate_blend_mode_for_alpha_formats()
@ 2026-07-29 21:45 Leandro Ribeiro
  2026-07-29 21:45 ` [PATCH 1/1] " Leandro Ribeiro
  0 siblings, 1 reply; 4+ messages in thread
From: Leandro Ribeiro @ 2026-07-29 21:45 UTC (permalink / raw)
  To: dri-devel
  Cc: airlied, broonie, daniels, jani.nikula, maarten.lankhorst,
	miguel.ojeda.sandonis, mripard, pekka.paalanen, simona,
	penguin-kernel, tytso, tzimmermann, ville.syrjala, linux-kernel

This replaces a WARN() with drm_warn() in
validate_blend_mode_for_alpha_formats().

The condition is expected to be triggered by existing drivers while they
adapt to the new blend mode requirement, so it should not use the kernel
warning report mechanism. WARN() output can cause fuzzers to stop when
they encounter a "WARNING:" message.

drm_warn() keeps the warning visible to driver developers without
triggering a WARN().

Leandro Ribeiro (1):
  drm: use drm_warn() in validate_blend_mode_for_alpha_formats()

 drivers/gpu/drm/drm_mode_config.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

-- 
2.55.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/1] drm: use drm_warn() in validate_blend_mode_for_alpha_formats()
  2026-07-29 21:45 [PATCH 0/1] drm: use drm_warn() in validate_blend_mode_for_alpha_formats() Leandro Ribeiro
@ 2026-07-29 21:45 ` Leandro Ribeiro
  2026-07-29 21:55   ` sashiko-bot
  2026-07-29 22:13   ` Tetsuo Handa
  0 siblings, 2 replies; 4+ messages in thread
From: Leandro Ribeiro @ 2026-07-29 21:45 UTC (permalink / raw)
  To: dri-devel
  Cc: airlied, broonie, daniels, jani.nikula, maarten.lankhorst,
	miguel.ojeda.sandonis, mripard, pekka.paalanen, simona,
	penguin-kernel, tytso, tzimmermann, ville.syrjala, linux-kernel

Commit 860e748bddcc ("drm: ensure blend mode supported if pixel format
with alpha exposed") introduced a WARN() to let driver developers know
that a previously valid behavior should now be changed.

But WARN() should not be used for that, as it's a kernel warning report
mechanism for conditions that are not expected to happen. It also
produces a stack trace. Instead, a simple warning-level log message
should have been used, as drivers were expected to trigger the
condition.

This is causing problems for fuzzers, as they may stop when encountering
a "BUG:" or "WARNING:" in the logs.

Replace WARN() with drm_warn() in this function, avoiding these issues.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
---
 drivers/gpu/drm/drm_mode_config.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
index 3bcc7bf0900c..3d9c554e08a8 100644
--- a/drivers/gpu/drm/drm_mode_config.c
+++ b/drivers/gpu/drm/drm_mode_config.c
@@ -869,8 +869,9 @@ static void validate_blend_mode_for_alpha_formats(struct drm_plane *plane)
 	for (i = 0; i < plane->format_count; i++) {
 		fmt = drm_format_info(plane->format_types[i]);
 		if (fmt->has_alpha) {
-			WARN(1, "[PLANE:%d:%s] pixel format with alpha exposed but blend mode not setup",
-			     plane->base.id, plane->name);
+			drm_warn(plane->dev,
+				 "[PLANE:%d:%s] pixel format with alpha exposed but blend mode not setup",
+				 plane->base.id, plane->name);
 			break;
 		}
 	}
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] drm: use drm_warn() in validate_blend_mode_for_alpha_formats()
  2026-07-29 21:45 ` [PATCH 1/1] " Leandro Ribeiro
@ 2026-07-29 21:55   ` sashiko-bot
  2026-07-29 22:13   ` Tetsuo Handa
  1 sibling, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-07-29 21:55 UTC (permalink / raw)
  To: Leandro Ribeiro; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Unconditional dereference of `drm_format_info()` return value leads to NULL pointer dereference for unrecognized formats.
--

--- Patch [1]: [PATCH 1/1] drm: use drm_warn() in validate_blend_mode_for_alpha_formats() ---
commit 8bcc8b572cfd0496af9f1e8dd202524f50670fa0
Author: Leandro Ribeiro <leandro.ribeiro@collabora.com>

drm: use drm_warn() in validate_blend_mode_for_alpha_formats()

This commit replaces WARN() with drm_warn() in
validate_blend_mode_for_alpha_formats() to prevent fuzzers from tripping
over kernel warning reports for expected driver validation issues.

> diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
> index 3bcc7bf0900c4..3d9c554e08a87 100644
> --- a/drivers/gpu/drm/drm_mode_config.c
> +++ b/drivers/gpu/drm/drm_mode_config.c
> @@ -869,8 +869,9 @@ static void validate_blend_mode_for_alpha_formats(struct drm_plane *plane)
>  	for (i = 0; i < plane->format_count; i++) {
>  		fmt = drm_format_info(plane->format_types[i]);
>  		if (fmt->has_alpha) {

[Severity: High]
This is a pre-existing issue, but could this unconditionally dereference
fmt if drm_format_info() returns NULL?

If a driver exposes an unrecognized or custom pixel format that the core
DRM does not know about, drm_format_info() returns NULL. Since the
purpose of this validation function is to catch driver bugs, should we
check if fmt is NULL before checking fmt->has_alpha to avoid a kernel
panic?

> -			WARN(1, "[PLANE:%d:%s] pixel format with alpha exposed but blend mode not setup",
> -			     plane->base.id, plane->name);
> +			drm_warn(plane->dev,
> +				 "[PLANE:%d:%s] pixel format with alpha exposed but blend mode not setup",
> +				 plane->base.id, plane->name);
>  			break;
>  		}
>  	}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260729214505.185776-2-leandro.ribeiro@collabora.com?part=1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] drm: use drm_warn() in validate_blend_mode_for_alpha_formats()
  2026-07-29 21:45 ` [PATCH 1/1] " Leandro Ribeiro
  2026-07-29 21:55   ` sashiko-bot
@ 2026-07-29 22:13   ` Tetsuo Handa
  1 sibling, 0 replies; 4+ messages in thread
From: Tetsuo Handa @ 2026-07-29 22:13 UTC (permalink / raw)
  To: Leandro Ribeiro, dri-devel
  Cc: airlied, broonie, daniels, jani.nikula, maarten.lankhorst,
	miguel.ojeda.sandonis, mripard, pekka.paalanen, simona, tytso,
	tzimmermann, ville.syrjala, linux-kernel

On 2026/07/30 6:45, Leandro Ribeiro wrote:
> Commit 860e748bddcc ("drm: ensure blend mode supported if pixel format
> with alpha exposed") introduced a WARN() to let driver developers know
> that a previously valid behavior should now be changed.
> 
> But WARN() should not be used for that, as it's a kernel warning report
> mechanism for conditions that are not expected to happen. It also
> produces a stack trace. Instead, a simple warning-level log message
> should have been used, as drivers were expected to trigger the
> condition.
> 
> This is causing problems for fuzzers, as they may stop when encountering
> a "BUG:" or "WARNING:" in the logs.
> 
> Replace WARN() with drm_warn() in this function, avoiding these issues.

Thank you. But could something like

  pr_warn("[PLANE:%d:%s] pixel format with alpha exposed but blend mode not setup. Please fix.", plane->base.id, plane->name);
  dump_stack();

be less prone to get oversighted (because of printing about 10+ lines)?


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-07-29 22:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-29 21:45 [PATCH 0/1] drm: use drm_warn() in validate_blend_mode_for_alpha_formats() Leandro Ribeiro
2026-07-29 21:45 ` [PATCH 1/1] " Leandro Ribeiro
2026-07-29 21:55   ` sashiko-bot
2026-07-29 22:13   ` Tetsuo Handa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.