Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/meson: unvalidated fb->offsets[0] alignment for OSD1
  canvas and GXM AFBC
--

commit 3b070782f8ebee577006ed589de24b8f70f0c4cc
Author: Guillaume La Roque <[email protected]>

drm/meson: keep RGB scanout state per OSD

This commit groups the OSD register cache and framebuffer parameters into a
per-plane struct meson_osd_state array while keeping the primary scaler and
AFBC controls separate.

> diff --git a/drivers/gpu/drm/meson/meson_plane.c 
> b/drivers/gpu/drm/meson/meson_plane.c
> index 0506e29b6ef3b..1698aaecee88b 100644
> --- a/drivers/gpu/drm/meson/meson_plane.c
> +++ b/drivers/gpu/drm/meson/meson_plane.c

[ ... ]

> @@ -368,19 +369,16 @@ static void meson_plane_atomic_update(struct drm_plane 
> *plane,
>               if (new_state->crtc->mode.flags & DRM_MODE_FLAG_INTERLACE)
>                       dst_h /= 2;
>  
> -             priv->viu.osd_blend_din0_scope_h = ((dest.x2 - 1) << 16) | 
> dest.x1;
> -             priv->viu.osd_blend_din0_scope_v = ((dest.y2 - 1) << 16) | 
> dest.y1;
> -             priv->viu.osb_blend0_size = dst_h << 16 | dst_w;
> -             priv->viu.osb_blend1_size = dst_h << 16 | dst_w;
> +             osd->blend_size = dst_h << 16 | dst_w;
>       }
>  
>       /* Update Canvas with buffer address */
>       gem = drm_fb_dma_get_gem_obj(fb, 0);
>  
> -     priv->viu.osd1_addr = gem->dma_addr + fb->offsets[0];
> -     priv->viu.osd1_stride = fb->pitches[0];
> -     priv->viu.osd1_height = fb->height;
> -     priv->viu.osd1_width = fb->width;
> +     osd->addr = gem->dma_addr + fb->offsets[0];
> +     osd->stride = fb->pitches[0];
> +     osd->height = fb->height;
> +     osd->width = fb->width;

[Severity: Medium]
Does meson_plane_atomic_check() validate fb->offsets[0] alignment before
osd->addr is programmed?

drm_gem_fb_create() checks buffer size but not fb->offsets[0] alignment.  For
linear scanout, meson_canvas_config() rounds addr up to an 8-byte boundary
via ((addr + 7) >> 3), shifting scanout and allowing canvas DMA to read up to
8 bytes past the end of a tightly sized buffer.

For GXM AFBC, meson_gxm_afbcd_setup() shifts priv->viu.osd[0].addr right by 4
bits, silently dropping the low 4 bits of a non-16-byte-aligned address and
pointing the decoder at the wrong header.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=3

Reply via email to