Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Chen-Yu Tsai" <wenst@chromium.org>
Cc: linux-sunxi@lists.linux.dev, imx@lists.linux.dev,
	dri-devel@lists.freedesktop.org, Frank.Li@kernel.org
Subject: Re: [PATCH RFT v4 4/5] drm/imx/dc: plane: Switch to drm_fb_dma_get_gem_clipped_addr()
Date: Thu, 26 Nov 2026 07:27:24 +0000	[thread overview]
Message-ID: <sashiko-outbox-234954@kernel.org> (raw)
In-Reply-To: <20261126071314.253890-5-wenst@chromium.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/imx/dc: off-screen plane programs out-of-bounds DMA
  address and 0 size
--

commit cf4b0408a88e14e3a67afb3b4cd1719d2796a174
Author: Chen-Yu Tsai <wenst@chromium.org>

drm/imx/dc: plane: Switch to drm_fb_dma_get_gem_clipped_addr()

This commit switches dc_plane_check_fb() and dc_plane_atomic_update() to
drm_fb_dma_get_gem_clipped_addr() so the framebuffer DMA base address uses
clipped source coordinates.

> diff --git a/drivers/gpu/drm/imx/dc/dc-plane.c b/drivers/gpu/drm/imx/dc/dc-plane.c
> index 62dd0576fadcb..35eb5039f5acf 100644
> --- a/drivers/gpu/drm/imx/dc/dc-plane.c
> +++ b/drivers/gpu/drm/imx/dc/dc-plane.c
> @@ -65,7 +65,7 @@ static int dc_plane_check_max_source_resolution(struct drm_plane_state *state)
>  static int dc_plane_check_fb(struct drm_plane_state *state)
>  {
>  	struct drm_framebuffer *fb = state->fb;
> -	dma_addr_t baseaddr = drm_fb_dma_get_gem_addr(fb, state, 0);
> +	dma_addr_t baseaddr = drm_fb_dma_get_gem_clipped_addr(fb, state, 0);
>  
>  	/* base address alignment */
>  	if (baseaddr & 0x3) {
> @@ -146,7 +146,7 @@ dc_plane_atomic_update(struct drm_plane *plane, struct drm_atomic_commit *state)
>  	src_w = drm_rect_width(&new_state->src) >> 16;
>  	src_h = drm_rect_height(&new_state->src) >> 16;
>  
> -	baseaddr = drm_fb_dma_get_gem_addr(fb, new_state, 0);
> +	baseaddr = drm_fb_dma_get_gem_clipped_addr(fb, new_state, 0);

[Severity: Medium]
Can drm_fb_dma_get_gem_clipped_addr() compute an out-of-bounds DMA address
when the plane is positioned completely off-screen?

dc_plane_atomic_check() calls drm_atomic_helper_check_plane_state() with
can_position = true.  When a plane is moved completely outside the CRTC
bounds, drm_rect_clip_scaled() sets plane_state->visible = false and clips
src.x1 == src.x2 (up to fb->width << 16) or src.y1 == src.y2 (up to
fb->height << 16), while drm_atomic_helper_check_plane_state() still
returns 0.

Because neither dc_plane_atomic_check() nor dc_plane_atomic_update() checks
plane_state->visible, drm_fb_dma_get_gem_clipped_addr() computes baseaddr
at (src.x1 >> 16, src.y1 >> 16), which can point past the end of the
framebuffer GEM object, and dc_plane_atomic_update() programs that address
along with zero src_w or src_h into the FetchUnit while enabling the source
buffer.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126071314.253890-1-wenst@chromium.org?part=4

  reply	other threads:[~2026-11-26  7:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  7:12 [PATCH RFT v4 0/5] drm: Add and use drm_fb_dma_get_gem_clipped_addr() helper Chen-Yu Tsai
2026-11-26  7:12 ` [PATCH RFT v4 1/5] drm: Split framebuffer pixel offset calculation from drm_fb_dma_get_gem_addr() Chen-Yu Tsai
2026-11-26  7:12 ` [PATCH RFT v4 2/5] drm/fb-dma-helper: Add drm_fb_dma_get_gem_clipped_addr() Chen-Yu Tsai
2026-11-26  7:12 ` [PATCH RFT v4 3/5] drm/sun4i: layers: Fix VI buffer address for clipped offsets Chen-Yu Tsai
2026-11-26  7:12 ` [PATCH RFT v4 4/5] drm/imx/dc: plane: Switch to drm_fb_dma_get_gem_clipped_addr() Chen-Yu Tsai
2026-11-26  7:27   ` sashiko-bot [this message]
2026-11-26  7:12 ` [PATCH RFT v4 5/5] drm/imx/dcss: " Chen-Yu Tsai

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=sashiko-outbox-234954@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=imx@lists.linux.dev \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wenst@chromium.org \
    /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