From: sashiko-bot@kernel.org
To: "Piórkowski, Piotr" <piotr.piorkowski@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v1 4/4] drm/xe/kunit: Add tests for PF-mem regions
Date: Thu, 13 Aug 2026 10:37:19 +0000 [thread overview]
Message-ID: <20260813103719.E27BC1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260813102511.200690-5-piotr.piorkowski@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] If `devm_ioremap_wc()` fails, `vram->mapping` is incorrectly initialized to an invalid non-NULL pointer when `offset > 0`, leading to downstream kernel panics.
--
--- Patch [4]: [PATCH v1 4/4] drm/xe/kunit: Add tests for PF-mem regions ---
commit e9c2a7426069b7396e0ca724779e07a5d5cec440
Author: Piotr Piórkowski <piotr.piorkowski@intel.com>
drm/xe/kunit: Add tests for PF-mem regions
Add coverage for PF-mem VRAM region metadata, bounds checking, and
full, partial, and missing CPU visibility.
> diff --git a/drivers/gpu/drm/xe/tests/xe_vram.c b/drivers/gpu/drm/xe/tests/xe_vram.c
> new file mode 100644
> index 0000000000000..36a49fbef2206
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/tests/xe_vram.c
> @@ -0,0 +1,115 @@
> +// SPDX-License-Identifier: GPL-2.0 AND MIT
> +/*
> + * Copyright © 2026 Intel Corporation
> + */
[ ... ]
> +static void pfmem_create(struct kunit *test)
> +{
> + struct xe_device *xe = test->priv;
> + struct xe_vram_region parent = pfmem_parent(xe, SZ_64M);
> + struct xe_vram_region *vram;
> +
> + vram = xe_vram_region_alloc_pfmem(xe, 0);
> + KUNIT_ASSERT_NOT_NULL(test, vram);
> + KUNIT_ASSERT_EQ(test, xe_vram_region_init_pfmem(vram, &parent, SZ_4M, SZ_16M), 0);
[Severity: High]
This is a pre-existing issue, but does the underlying initialization logic
have an unchecked mapping issue?
If devm_ioremap_wc() fails in determine_lmem_bar_size(), it returns NULL,
but determine_lmem_bar_size() doesn't check for this and returns 0 (success).
Later, vram_region_init() executes:
vram->mapping = lmem_bar->mapping + offset;
If lmem_bar->mapping is NULL, this pointer arithmetic creates a non-NULL
invalid pointer when offset > 0 (which happens for non-zero tiles or when
initializing a PF-mem region via xe_vram_region_init_pfmem() called here).
Because vram->mapping is no longer NULL, subsequent checks like
if (vram->mapping) evaluate to true, leading to a kernel panic when the
invalid pointer is dereferenced.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260813102511.200690-1-piotr.piorkowski@intel.com?part=4
next prev parent reply other threads:[~2026-08-13 10:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 10:25 [PATCH v1 0/4] Introduce PF-mem VRAM regions Piórkowski, Piotr
2026-08-13 10:25 ` [PATCH v1 1/4] drm/xe/vram: Add binding information to " Piórkowski, Piotr
2026-08-13 10:25 ` [PATCH v1 2/4] drm/xe/ttm: Add PF-mem VRAM placement types for TTM Piórkowski, Piotr
2026-08-13 10:39 ` sashiko-bot
2026-08-13 10:25 ` [PATCH v1 3/4] drm/xe/vram: Add initial support for PF-mem regions Piórkowski, Piotr
2026-08-13 10:38 ` sashiko-bot
2026-08-13 10:25 ` [PATCH v1 4/4] drm/xe/kunit: Add tests " Piórkowski, Piotr
2026-08-13 10:37 ` sashiko-bot [this message]
2026-08-13 10:31 ` ✗ CI.checkpatch: warning for Introduce PF-mem VRAM regions Patchwork
2026-08-13 10:33 ` ✓ CI.KUnit: success " Patchwork
2026-08-13 11:33 ` ✓ Xe.CI.BAT: " 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=20260813103719.E27BC1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=piotr.piorkowski@intel.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