From: sashiko-bot@kernel.org
To: "Icenowy Zheng" <zhengxingda@iscas.ac.cn>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/verisilicon: set blend mode for the primary plane
Date: Tue, 01 Sep 2026 17:27:45 +0000 [thread overview]
Message-ID: <20260901172745.859B01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260901171703.1161592-1-zhengxingda@iscas.ac.cn>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
New issues:
- [Medium] The return value of `drm_plane_create_blend_mode_property` is ignored.
Pre-existing issues:
- [Critical] Dereferencing a NULL `crtc` pointer in `vs_primary_plane_atomic_disable` during offscreen plane transitions.
- [High] `vs_primary_plane_atomic_disable` incorrectly sets the enable bit instead of clearing it.
--
commit 9aa67f5c63b091d89b8b4a7a3066a896f35cf108
Author: Icenowy Zheng <zhengxingda@iscas.ac.cn>
drm/verisilicon: set blend mode for the primary plane
Blend modes are now required to expose pixel formats w/ alpha.
As it's the primary plane and blending is explicitly disabled, just
expose PIXEL_NONE blend mode.
> diff --git a/drivers/gpu/drm/verisilicon/vs_primary_plane.c b/drivers/gpu/drm/verisilicon/vs_primary_plane.c
> index 1f2be41ae496c..8d58682d88ef8 100644
> --- a/drivers/gpu/drm/verisilicon/vs_primary_plane.c
> +++ b/drivers/gpu/drm/verisilicon/vs_primary_plane.c
> @@ -7,6 +7,7 @@
>
> #include <drm/drm_atomic.h>
> #include <drm/drm_atomic_helper.h>
> +#include <drm/drm_blend.h>
> #include <drm/drm_crtc.h>
> #include <drm/drm_fourcc.h>
> #include <drm/drm_framebuffer.h>
[ ... ]
[Severity: Critical]
This is a pre-existing issue, but can this dereference a NULL pointer during
offscreen plane transitions?
If userspace commits an atomic state where a plane transitions from fully
disabled (old_state->crtc == NULL) to assigned but offscreen
(new_state->crtc != NULL but new_state->visible == false), the DRM core
calls vs_primary_plane_atomic_update().
This function sees !state->visible and delegates to the disable function:
vs_primary_plane_atomic_update() {
...
if (!state->visible) {
vs_primary_plane_atomic_disable(plane, atomic_state);
return;
}
...
}
The disable function then fetches old_state->crtc, which is NULL, and
dereferences it:
vs_primary_plane_atomic_disable() {
...
struct drm_plane_state *state = drm_atomic_get_old_plane_state(atomic_state,
plane);
struct drm_crtc *crtc = state->crtc;
struct vs_crtc *vcrtc = drm_crtc_to_vs_crtc(crtc);
unsigned int output = vcrtc->id;
...
}
[Severity: High]
This isn't a bug introduced by this patch, but does
vs_primary_plane_atomic_disable() incorrectly set the enable bit instead of
clearing it?
vs_primary_plane_atomic_disable() {
...
regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
VSDC_FB_CONFIG_EX_FB_EN);
vs_primary_plane_commit(dc, output);
}
When the plane needs to be disabled, the core calls this function, which uses
regmap_set_bits() with the VSDC_FB_CONFIG_EX_FB_EN bit.
Should this use regmap_clear_bits() instead? The hardware plane is never
disabled, which can cause visual corruption, unexpected display state, and
potential memory access faults if the buffer memory is subsequently freed
while the hardware is still scanning it out.
> @@ -179,5 +180,7 @@ struct drm_plane *vs_primary_plane_init(struct drm_device *drm_dev, struct vs_dc
>
> drm_plane_helper_add(plane, &vs_primary_plane_helper_funcs);
>
> + drm_plane_create_blend_mode_property(plane,
> + BIT(DRM_MODE_BLEND_PIXEL_NONE));
[Severity: Medium]
Is it intentional to ignore the return value of
drm_plane_create_blend_mode_property()?
If property creation fails (e.g. due to memory exhaustion), the plane is
initialized without the requested blend mode property, breaking userspace
expectations for alpha formats. Should this function check for an error code
and handle the failure?
> return plane;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260901171703.1161592-1-zhengxingda@iscas.ac.cn?part=1
prev parent reply other threads:[~2026-09-01 17:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 17:17 [PATCH 1/2] drm/verisilicon: set blend mode for the primary plane Icenowy Zheng
2026-09-01 17:17 ` [PATCH 2/2] drm/verisilicon: set blend mode for the cursor plane Icenowy Zheng
2026-09-01 17:39 ` sashiko-bot
2026-09-01 17:27 ` sashiko-bot [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=20260901172745.859B01F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=zhengxingda@iscas.ac.cn \
/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