From: sashiko-bot@kernel.org
To: "Maarten Lankhorst" <dev@lankhorst.se>, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v4 1/6] drm/xe/ggtt: Add xe_ggtt_reserve_area
Date: Mon, 16 Nov 2026 12:38:44 +0000 [thread overview]
Message-ID: <sashiko-outbox-217015@kernel.org> (raw)
In-Reply-To: <20261116122828.266113-9-dev@lankhorst.se>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/xe/ggtt: 32-bit overflow on base + size in
xe_ggtt_reserve_area()
- [Low] drm/xe/ggtt: kernel-doc parameter mismatch in
xe_ggtt_reserve_area()
--
commit 1478ac0c6b7aadab2f5f53794d373565e2e70a03
Author: Maarten Lankhorst <dev@lankhorst.se>
drm/xe/ggtt: Add xe_ggtt_reserve_area
This commit adds xe_ggtt_reserve_area() and a helper xe_ggtt_insert_node_at()
to reserve a specific GGTT range clipped to addressable GGTT boundaries.
> diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c
> index 9ef2ce743770f..ca38d51f41441 100644
> --- a/drivers/gpu/drm/xe/xe_ggtt.c
> +++ b/drivers/gpu/drm/xe/xe_ggtt.c
[ ... ]
> @@ -708,6 +722,53 @@ struct xe_ggtt_node *xe_ggtt_insert_node(struct xe_ggtt *ggtt, u32 size, u32 ali
> return node;
> }
>
> +/**
> + * xe_ggtt_reserve_area - Ensure an area of the GGTT is reserved.
> + * @ggtt: the &xe_ggtt where the area should be reserved.
> + * @start: Starting offset of range to reserve
> + * @size: size of the reservation
> + *
> + * This function ensures the area of [start...start+size)
> + * is reserved, while taking care of any clipping due to start or start+size
> + * falling outside of the adressable GGTT. The size of the returned node may
> + * be smaller if part of the region falls outside the accessible GGTT, or a
> + * NULL node may be returned.
> + *
> + * Return: &xe_ggtt_node or NULL on success or a ERR_PTR on failure.
> + */
> +struct xe_ggtt_node *xe_ggtt_reserve_area(struct xe_ggtt *ggtt, u32 base, u32 size)
[Severity: Low]
The kernel-doc comment documents @start, while the parameter in the function
signature is named base, which triggers a kernel-doc warning under W=1 or
htmldocs builds.
> +{
> + u64 ggtt_start = xe_ggtt_start(ggtt), ggtt_end = ggtt_start + xe_ggtt_size(ggtt);
> +
> + /* Completely truncated? */
> + if (base + size <= ggtt_start || base >= ggtt_end)
> + return NULL;
> +
> + /* Partially truncated? */
> + if (base <= ggtt_start) {
> + size -= ggtt_start - base;
> + base = ggtt_start;
> + }
> +
> + if (base + size >= ggtt_end)
> + size = ggtt_end - base;
> +
> + return xe_ggtt_insert_node_at(ggtt, size, XE_PAGE_SIZE, base, base + size);
> +}
[Severity: Medium]
Can base + size overflow 32 bits before being compared against ggtt_start and
ggtt_end or passed to xe_ggtt_insert_node_at()?
Both base and size are u32, while the hardware GGTT is 4 GiB and the usable
GGTT ends at GUC_GGTT_TOP (0xfee00000). If a reservation near the top of the
GGTT reaches or crosses the 4 GiB boundary, base + size wraps around in 32-bit
arithmetic: wrapping to <= ggtt_start (such as 0 at 4 GiB) makes
xe_ggtt_reserve_area() return NULL without reserving [base, ggtt_end), while
wrapping into (ggtt_start, ggtt_end) skips the ggtt_end clip and passes end <
start to drm_mm_insert_node_in_range(), hitting DRM_MM_BUG_ON(range_start >
range_end). Taking base and size as u64 (or casting before addition) avoids
the wraparound.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116122828.266113-8-dev@lankhorst.se?part=1
next prev parent reply other threads:[~2026-11-16 12:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 12:28 [PATCH v4 0/6] drm/xe: More BIOS FB takeover fixes Maarten Lankhorst
2026-11-16 12:28 ` [PATCH v4 1/6] drm/xe/ggtt: Add xe_ggtt_reserve_area Maarten Lankhorst
2026-11-16 12:38 ` sashiko-bot [this message]
2026-11-16 12:28 ` [PATCH v4 2/6] drm/xe/ggtt: Add xe_ggtt_node_remove_noclear Maarten Lankhorst
2026-11-16 12:28 ` [PATCH v4 3/6] drm/xe/display: Reserve the original GGTT space before creating a bo Maarten Lankhorst
2026-11-16 12:28 ` [PATCH v4 4/6] drm/xe/display: Use the correct calculation for phys_base on integrated Maarten Lankhorst
2026-11-16 12:49 ` sashiko-bot
2026-11-16 12:28 ` [PATCH v4 5/6] drm/xe/display: Remove duplicated code Maarten Lankhorst
2026-11-16 12:56 ` sashiko-bot
2026-11-16 12:28 ` [PATCH v4 6/6] drm/xe/ggtt: Remove xe_ggtt_insert_bo_at Maarten Lankhorst
2026-11-16 14:40 ` ✗ CI.checkpatch: warning for drm/xe: More BIOS FB takeover fixes (rev5) Patchwork
2026-11-16 14:43 ` ✓ CI.KUnit: success " Patchwork
2026-11-16 15:17 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-16 23:16 ` ✗ Xe.CI.FULL: failure " Patchwork
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-217015@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dev@lankhorst.se \
--cc=intel-xe@lists.freedesktop.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.