Re: [PATCH] drm/xe/svm: Initialize xpagemap to NULL in xe_svm_get_pagemaps()

From: Thomas Hellström

Date: Thu Nov 19 2026 - 12:24:15 EST


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@xxxxxxxxxx>

Reviewed-by: Thomas Hellström <thomas.hellstrom@xxxxxxxxxxxxxxx>

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;
>