From: sashiko-bot@kernel.org
To: "Maxime Ripard" <mripard@kernel.org>
Cc: linux-sunxi@lists.linux.dev, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 54/60] drm/sun4i: layer: Convert to atomic_create_state
Date: Thu, 09 Jul 2026 12:33:46 +0000 [thread overview]
Message-ID: <20260709123346.B8DA81F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260709-drm-no-more-plane-reset-v1-54-302d986fe5f0@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Leftover state destruction code in `atomic_create_state` callback violates API contract
--
--- Patch [54]: [PATCH 54/60] drm/sun4i: layer: Convert to atomic_create_state ---
commit 85f4174b6e45254800a7a99399fee4bf10972b0f
Author: Maxime Ripard <mripard@kernel.org>
drm/sun4i: layer: Convert to atomic_create_state
This commit converts the plane reset implementation in sun4i to use
atomic_create_state instead. The conversion relies on a Coccinelle semantic
patch to rename the functions and update the DRM plane function assignments.
> diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c b/drivers/gpu/drm/sun4i/sun4i_layer.c
> index d65587d96d9ee..b165960ca8e5d 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_layer.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_layer.c
> @@ -16,7 +16,7 @@
> #include "sun4i_layer.h"
> #include "sunxi_engine.h"
>
> -static void sun4i_backend_layer_reset(struct drm_plane *plane)
> +static struct drm_plane_state *sun4i_backend_layer_create_state(struct drm_plane *plane)
> {
> struct sun4i_layer_state *state;
>
> @@ -30,8 +30,12 @@ static void sun4i_backend_layer_reset(struct drm_plane *plane)
> }
[Severity: Medium]
Does the Coccinelle script miss the plane state destruction block here?
Looking at sun4i_backend_layer_create_state() in sun4i_layer.c, the untouched
code right above this hunk still contains legacy state destruction logic:
if (plane->state) {
state = state_to_sun4i_layer_state(plane->state);
__drm_atomic_helper_plane_destroy_state(&state->state);
kfree(state);
plane->state = NULL;
}
Since atomic_create_state is expected to be a pure constructor without side
effects, shouldn't this block be removed?
While plane->state is currently guaranteed to be NULL when this is called by
the DRM core, retaining this block could lead to a use-after-free if any driver
logic later calls this hook directly on an active plane.
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260709-drm-no-more-plane-reset-v1-0-302d986fe5f0@kernel.org?part=54
prev parent reply other threads:[~2026-07-09 12:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 11:50 [PATCH 00/60] drm/plane: Convert all drivers to atomic_create_state and remove reset Maxime Ripard
2026-07-09 11:50 ` [PATCH 32/60] drm/sun4i: sun8i: Convert to atomic_create_state Maxime Ripard
2026-07-09 12:24 ` sashiko-bot
2026-07-09 11:51 ` [PATCH 54/60] drm/sun4i: layer: " Maxime Ripard
2026-07-09 12:33 ` 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=20260709123346.B8DA81F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=mripard@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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