Linux-HyperV List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Thomas Zimmermann" <tzimmermann@suse.de>
Cc: linux-hyperv@vger.kernel.org
Subject: Re: [PATCH v3 06/10] drm/damage-helper: Remove old state from drm_atomic_helper_damage_iter_init()
Date: Wed, 27 May 2026 15:07:29 +0000	[thread overview]
Message-ID: <20260527150730.35C6B1F00A3E@smtp.kernel.org> (raw)
In-Reply-To: <20260527145113.241595-7-tzimmermann@suse.de>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [Critical] Integer overflow in `frames_size` accumulation in `appletbdrm_primary_plane_helper_begin_fb_access()` leads to an undersized allocation and subsequent heap buffer overflow.
--

commit 95dfe9915dca0c203d54cd610ead65b1de9a07b7
Author: Thomas Zimmermann <tzimmermann@suse.de>

drm/damage-helper: Remove old state from drm_atomic_helper_damage_iter_init()

This commit removes the unused old_plane_state parameter from
drm_atomic_helper_damage_iter_init() and updates all callers. Most callers
no longer require the old plane state in their atomic_update helpers.

[ ... ]

> diff --git a/drivers/gpu/drm/tiny/appletbdrm.c b/drivers/gpu/drm/tiny/appletbdrm.c
> index b683dcb35b0be..eadc3aed72774 100644
> --- a/drivers/gpu/drm/tiny/appletbdrm.c
> +++ b/drivers/gpu/drm/tiny/appletbdrm.c
> @@ -324,7 +324,7 @@ static int appletbdrm_primary_plane_helper_begin_fb_access(struct drm_plane *pla
>  	struct drm_rect damage;
>  	size_t request_size;
>  
> -	drm_atomic_helper_damage_iter_init(&iter, NULL, new_plane_state);
> +	drm_atomic_helper_damage_iter_init(&iter, new_plane_state);
>  	drm_atomic_for_each_plane_damage(&iter, &damage) {
>  		frames_size += struct_size((struct appletbdrm_frame *)0, buf, rect_size(&damage));

[Severity: Critical]
This is a pre-existing issue, but can this loop cause an integer overflow
when accumulating frames_size?

Because += is used instead of safe accumulation like size_add(), supplying a
large number of clips (or clips with large dimensions) could cause the size_t
variable frames_size to wrap around. For example, on 32-bit systems, a large
amount of damage clips can map to >4GB of frame data. 

This would result in an undersized buffer being allocated via kvzalloc().

Subsequently, in appletbdrm_flush_damage(), the code iterates over the same
clips and uses drm_fb_memcpy() or drm_fb_xrgb8888_to_bgr888() to copy the
full unclipped frame data into the destination buffer, potentially causing a
heap buffer overflow.

>  	}

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260527145113.241595-1-tzimmermann@suse.de?part=6

  reply	other threads:[~2026-05-27 15:07 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-27 14:46 [PATCH v3 00/10] Thomas Zimmermann
2026-05-27 14:46 ` [PATCH v3 01/10] drm/damage-helper: Do not alter damage clips on modeset, but ignore them Thomas Zimmermann
2026-05-27 15:19   ` sashiko-bot
2026-05-28  6:14     ` Thomas Zimmermann
2026-05-27 14:46 ` [PATCH v3 02/10] drm/atomic-helpers: Evaluate plane damage after atomic_check Thomas Zimmermann
2026-05-27 14:46 ` [PATCH v3 03/10] drm/ingenic: Remove calls to drm_atomic_helper_check_plane_damage() Thomas Zimmermann
2026-05-27 14:46 ` [PATCH v3 04/10] drm/damage-helper: Test src coord in drm_atomic_helper_check_plane_damage() Thomas Zimmermann
2026-05-27 15:11   ` sashiko-bot
2026-05-27 14:46 ` [PATCH v3 05/10] drm/appletbdrm: Allocate request/response buffers in begin_fb_access Thomas Zimmermann
2026-05-27 15:42   ` sashiko-bot
2026-05-28  6:26     ` Thomas Zimmermann
2026-05-27 14:46 ` [PATCH v3 06/10] drm/damage-helper: Remove old state from drm_atomic_helper_damage_iter_init() Thomas Zimmermann
2026-05-27 15:07   ` sashiko-bot [this message]
2026-05-27 14:46 ` [PATCH v3 07/10] drm/damage-helper: Remove old state from drm_atomic_helper_damage_merged() Thomas Zimmermann
2026-05-27 15:10   ` sashiko-bot
2026-05-28  6:20     ` Thomas Zimmermann
2026-05-27 14:46 ` [PATCH v3 08/10] drm/atomic_helper: Do not evaluate plane damage before atomic_check Thomas Zimmermann
2026-05-27 14:46 ` [PATCH v3 09/10] drm/damage-helper: Rename state parameters in damage helpers Thomas Zimmermann
2026-05-27 14:46 ` [PATCH v3 10/10] drm/vmwgfx: Remove unused field struct vmwgfx_du_update_plane.old_state Thomas Zimmermann
2026-05-27 15:22   ` sashiko-bot
2026-05-28  6:21     ` Thomas Zimmermann
2026-05-27 15:17 ` [PATCH v3 00/10] drm: Improve logic behind damage handling Thomas Zimmermann

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=20260527150730.35C6B1F00A3E@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tzimmermann@suse.de \
    /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