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 <[email protected]> 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/[email protected]?part=4
