dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Oarora Etimis" <oaroraetimis@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 2/2] drm/vkms: copy a full-screen frame straight to writeback
Date: Thu, 26 Nov 2026 17:09:31 +0000	[thread overview]
Message-ID: <sashiko-outbox-235963@kernel.org> (raw)
In-Reply-To: <20261126-composer-fastpath-v2-2-292ed6d4c4d6@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] drm/vkms: out-of-bounds dereference in compose_active_planes()
  with 0 planes
--

commit 78d03e558f502868143b5675a866d31e9e3f5440
Author: Oarora Etimis <oaroraetimis@gmail.com>

drm/vkms: copy a full-screen frame straight to writeback

This commit copies a single full-screen XRGB8888 plane directly into a
matching writeback framebuffer without allocating or blending through the
16-bit line buffer when CRC generation and gamma LUT are disabled.

> diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c
> index 4e2dd568bc3e3..239fdaca2926a 100644
> --- a/drivers/gpu/drm/vkms/vkms_composer.c
> +++ b/drivers/gpu/drm/vkms/vkms_composer.c

[ ... ]

> @@ -690,6 +734,17 @@ static int compose_active_planes(struct vkms_writeback_job *active_wb,
>  	if (WARN_ON(check_format_funcs(crtc_state, active_wb)))
>  		return -EINVAL;
>  
> +	direct = compose_direct(crtc_state);
> +
> +	plane = crtc_state->active_planes[0];
> +
> +	if (direct && writeback_direct(crtc_state, active_wb, plane, crc_on)) {
> +		for (int y = 0; y < crtc_state->base.mode.vdisplay; y++)
> +			vkms_writeback_row_direct(active_wb, plane, y);
> +
> +		return 0;
> +	}

[Severity: High]
Can this dereference crtc_state->active_planes[0] when
crtc_state->num_active_planes is 0?

When an active CRTC has no visible planes, vkms_crtc_atomic_check()
allocates active_planes with kzalloc_objs(..., 0), which returns
ZERO_SIZE_PTR.  compose_direct() checks that num_active_planes == 1 and
returns false, but reading crtc_state->active_planes[0] before testing
direct faults on ZERO_SIZE_PTR.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126-composer-fastpath-v2-0-292ed6d4c4d6@gmail.com?part=2

      reply	other threads:[~2026-11-26 17:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 16:59 [PATCH v2 0/2] drm/vkms: skip composer work that changes nothing Oarora Etimis
2026-11-26 16:59 ` [PATCH v2 1/2] drm/vkms: skip a blend that cannot change the frame Oarora Etimis
2026-11-26 16:59 ` [PATCH v2 2/2] drm/vkms: copy a full-screen frame straight to writeback Oarora Etimis
2026-11-26 17:09   ` 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=sashiko-outbox-235963@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=oaroraetimis@gmail.com \
    --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