drm: use drm_warn() in validate_blend_mode_for_alpha_formats()
Subsystems (6)
v2 cover drm: use drm_warn() in validate_blend_mode_for_alpha_formats()
This replaces a WARN() with drm_warn() invalidate_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().
Changes in v2:
- Make the warning message more explicit
- Add a "Fixes" tag to commit
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(-)
Signature · 1 line
2.55.0
PATCH v2 1/1 drm: use drm_warn() in validate_blend_mode_for_alpha_formats()
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.
--- drivers/gpu/drm/drm_mode_config.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_mode_config.c +3 -2
@@ -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. Please fix." , + plane->base.id, plane->name);break ; } }
Signature · 1 line
2.55.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [Low] Missing trailing newline in drm_warn() format string.
Pre-existing issues:
- [High] Missing NULL check on the return value of drm_format_info() before dereferencing it. --
--- Patch [1]: [PATCH v2 1/1] drm: use drm_warn() in validate_blend_mode_for_alpha_formats() --- commit e7f907e9d21d7af4bbeb8c955471b68c362de2e1
Author: Leandro Ribeiro <[email protected]>
drm: use drm_warn() in validate_blend_mode_for_alpha_formats()
This commit replaces a WARN() with drm_warn() in validate_blend_mode_for_alpha_formats() to prevent fuzzers from stopping when drivers encounter a pixel format with alpha exposed but no blend mode setup.
drivers/gpu/drm/drm_mode_config.c static void validate_blend_mode_for_alpha_formats(struct drm_plane *plane) · line 871
Quoted 8 lines
drivers/gpu/drm/drm_mode_config.c +0
-0@@ -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 isn't a bug introduced by this patch, but is it possible for drm_format_info() to return NULL here?
If a driver exposes an unknown or unsupported format in the format_types array, drm_format_info() returns NULL, and this line will trigger a NULL pointer dereference during plane validation.
drivers/gpu/drm/drm_mode_config.c static void validate_blend_mode_for_alpha_formats(struct drm_plane *plane) · line 873
Quoted 4 lines
drivers/gpu/drm/drm_mode_config.c +2
-2-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. Please fix.",
[Severity: Low]
Should this format string end with a newline character?
Without a trailing \n, this warning message might remain buffered or get concatenated with subsequent unrelated kernel log messages.
Quoted 4 lines
drivers/gpu/drm/drm_mode_config.c +1
-0+ plane->base.id, plane->name);break ; } }
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Who is supposed to take this patch?
Since this problem is preventing syzbot from testing changes in linux-next kernels for more than three weeks, I expect this patch to be applied as soon as possible.
Quoted 20 lines · Leandro Ribeiro
Commit
860e748bddcc("drm: ensure blend mode supported if pixel format with alpha exposed") introduced aWARN()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()withdrm_warn()in this function, avoiding these issues.Fixes 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")Signed-off-by Leandro Ribeiro <[email protected]>--- drivers/gpu/drm/drm_mode_config.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Merge window will open shortly. Can we have this fix applied before commit 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed") hits upstream?
Quoted 27 lines · Tetsuo Handa
Who is supposed to take this patch?
Since this problem is preventing syzbot from testing changes in linux-next kernels for more than three weeks, I expect this patch to be applied as soon as possible.
Quoted 20 lines · Leandro Ribeiro
Commit
860e748bddcc("drm: ensure blend mode supported if pixel format with alpha exposed") introduced aWARN()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()withdrm_warn()in this function, avoiding these issues.Fixes 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")Signed-off-by Leandro Ribeiro <[email protected]>--- drivers/gpu/drm/drm_mode_config.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Hi Tetsuo,
Quoted 3 lines · Tetsuo Handa
Merge window will open shortly. Can we have this fix applied before commit
860e748bddcc("drm: ensure blend mode supported if pixel format with alpha exposed") hits upstream?
This has now gone into drm-misc-next-fixes for the next pull in the cycle, and is already in DRM's for-linux-next.
Cheers,
Daniel
Hi Leandro,
Quoted 10 lines · Leandro Ribeiro
Commit
860e748bddcc("drm: ensure blend mode supported if pixel format with alpha exposed") introduced aWARN()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.
Quoted 7 lines
This is causing problems for fuzzers, as they may stop when encountering a "BUG:" or "WARNING:" in the logs.
Replace
WARN()withdrm_warn()in this function, avoiding these issues.Fixes 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")Signed-off-by Leandro Ribeiro <[email protected]>
Thanks, this is:
I'll fix up the newline when applying.
Cheers,
Daniel
Quoted 19 lines · Daniel Stone
Hi Leandro,
Quoted 15 lines · Leandro Ribeiro
Commit
860e748bddcc("drm: ensure blend mode supported if pixel format with alpha exposed") introduced aWARN()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()withdrm_warn()in this function, avoiding these issues.
Quoted 7 lines
Quoted 2 lines
Fixes 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")Signed-off-by Leandro Ribeiro <[email protected]>Thanks, this is:
Reviewed-by Daniel Stone <[email protected]>I'll fix up the newline when applying.
Hi Maarten, Maxime and Thomas,
can you cherry-pick this fix for drm-misc-fixes and send a pull-request to Dave and Simona before the end of this week? I think this should land in rc1 because people are already complaining about the warnings and it will take some time to fix all affected drivers. I'm not even sure if those fixes can land in mainline after rc1.
If you don't have the time to do this or the other fixes in drm-misc-fixes are not yet ready for mainline, I will ask Linus to pick this fix directly.
Viktor
Maxime Ripard
maintainerQuoted 36 lines · Viktor Jägersküpper
Quoted 19 lines · Daniel Stone
Hi Leandro,
Quoted 15 lines · Leandro Ribeiro
Commit
860e748bddcc("drm: ensure blend mode supported if pixel format with alpha exposed") introduced aWARN()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()withdrm_warn()in this function, avoiding these issues.Quoted 7 lines
Quoted 2 lines
Fixes 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")Signed-off-by Leandro Ribeiro <[email protected]>Thanks, this is:
Reviewed-by Daniel Stone <[email protected]>I'll fix up the newline when applying.
Hi Maarten, Maxime and Thomas,
can you cherry-pick this fix for drm-misc-fixes and send a pull-request to Dave and Simona before the end of this week? I think this should land in rc1 because people are already complaining about the warnings and it will take some time to fix all affected drivers. I'm not even sure if those fixes can land in mainline after rc1.
Quoted 3 lines
If you don't have the time to do this or the other fixes in drm-misc-fixes are not yet ready for mainline, I will ask Linus to pick this fix directly.
This has been sent last week:
https://lore.kernel.org/dri-devel/20260820-fabulous-nimble-woodpecker-ffa695@houat/
Maxime