* [PATCH] drm/xe/svm: Initialize xpagemap to NULL in xe_svm_get_pagemaps()
@ 2026-11-19 17:07 Ian Rogers
2026-11-19 17:24 ` Thomas Hellström
0 siblings, 1 reply; 2+ messages in thread
From: Ian Rogers @ 2026-11-19 17:07 UTC (permalink / raw)
To: Matthew Brost, Thomas Hellström, Rodrigo Vivi, David Airlie,
Simona Vetter
Cc: intel-xe, dri-devel, linux-kernel, llvm, Elkin Cruz, Ian Rogers
On integrated Intel Xe GPUs (!IS_DGFX), xe->info.mem_region_mask has no
per-tile VRAM bits set, so every iteration of for_each_tile() in
xe_svm_get_pagemaps() hits 'continue' without assigning 'xpagemap'. The
post-loop IS_ERR(xpagemap) check then evaluates an uninitialized stack
pointer on every fault/SVM VM creation.
Initialize 'xpagemap' to NULL so IS_ERR(xpagemap) evaluates false when no
VRAM regions exist.
Found via an x86_64 LLVM=1 (Clang 21.1.8) allyesconfig audit with
-Wconditional-uninitialized enabled; fix and changelog drafted with an AI
coding assistant. Build-tested under LLVM=1 W=1 (-Werror) and
-Wconditional-uninitialized; not runtime-tested on Intel Xe hardware.
Fixes: 8a52f4d9b1ef ("drm/xe: Use the drm_pagemap cache and shrinker")
Signed-off-by: Ian Rogers <irogers@google.com>
---
drivers/gpu/drm/xe/xe_svm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
index bc6902b5bf57..22cc7ed19d8a 100644
--- a/drivers/gpu/drm/xe/xe_svm.c
+++ b/drivers/gpu/drm/xe/xe_svm.c
@@ -2055,7 +2055,7 @@ xe_pagemap_find_or_create(struct xe_device *xe, struct drm_pagemap_cache *cache,
static int xe_svm_get_pagemaps(struct xe_vm *vm)
{
struct xe_device *xe = vm->xe;
- struct xe_pagemap *xpagemap;
+ struct xe_pagemap *xpagemap = NULL;
struct xe_tile *tile;
int id;
--
2.56.1.708.g77570a6a1d-goog
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/xe/svm: Initialize xpagemap to NULL in xe_svm_get_pagemaps()
2026-11-19 17:07 [PATCH] drm/xe/svm: Initialize xpagemap to NULL in xe_svm_get_pagemaps() Ian Rogers
@ 2026-11-19 17:24 ` Thomas Hellström
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Hellström @ 2026-11-19 17:24 UTC (permalink / raw)
To: Ian Rogers, Matthew Brost, Rodrigo Vivi, David Airlie, Simona Vetter
Cc: intel-xe, dri-devel, linux-kernel, llvm, Elkin Cruz
On Thu, 2026-11-19 at 09:07 -0800, Ian Rogers wrote:
> On integrated Intel Xe GPUs (!IS_DGFX), xe->info.mem_region_mask has
> no
> per-tile VRAM bits set, so every iteration of for_each_tile() in
> xe_svm_get_pagemaps() hits 'continue' without assigning 'xpagemap'.
> The
> post-loop IS_ERR(xpagemap) check then evaluates an uninitialized
> stack
> pointer on every fault/SVM VM creation.
>
> Initialize 'xpagemap' to NULL so IS_ERR(xpagemap) evaluates false
> when no
> VRAM regions exist.
>
> Found via an x86_64 LLVM=1 (Clang 21.1.8) allyesconfig audit with
> -Wconditional-uninitialized enabled; fix and changelog drafted with
> an AI
> coding assistant. Build-tested under LLVM=1 W=1 (-Werror) and
> -Wconditional-uninitialized; not runtime-tested on Intel Xe hardware.
>
> Fixes: 8a52f4d9b1ef ("drm/xe: Use the drm_pagemap cache and
> shrinker")
> Signed-off-by: Ian Rogers <irogers@google.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Thanks. Will add relevant Ccs from ("dim fixes") and push after CI
completes.
/Thomas
> ---
> drivers/gpu/drm/xe/xe_svm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_svm.c
> b/drivers/gpu/drm/xe/xe_svm.c
> index bc6902b5bf57..22cc7ed19d8a 100644
> --- a/drivers/gpu/drm/xe/xe_svm.c
> +++ b/drivers/gpu/drm/xe/xe_svm.c
> @@ -2055,7 +2055,7 @@ xe_pagemap_find_or_create(struct xe_device *xe,
> struct drm_pagemap_cache *cache,
> static int xe_svm_get_pagemaps(struct xe_vm *vm)
> {
> struct xe_device *xe = vm->xe;
> - struct xe_pagemap *xpagemap;
> + struct xe_pagemap *xpagemap = NULL;
> struct xe_tile *tile;
> int id;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-19 17:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19 17:07 [PATCH] drm/xe/svm: Initialize xpagemap to NULL in xe_svm_get_pagemaps() Ian Rogers
2026-11-19 17:24 ` Thomas Hellström
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®