From 718d95de7728848b1c476eee0e3ceaeef9593bc8 Mon Sep 17 00:00:00 2001 From: Kent Russell Date: Tue, 30 May 2023 15:43:36 -0400 Subject: [PATCH] fmm.c: Fix possibly initialized variable usage If we end up in the first if clause, aperture_base is not set, unlike the other 2 clauses. Initialize it to NULL at declaration time, and only change its value in the final else clause, where we set it to aperture->base Change-Id: I2bf44dc93cae8a03e66f41cedd85d57be2115bba Signed-off-by: Kent Russell --- src/fmm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/fmm.c b/src/fmm.c index efd424bb55..bf9e5191f6 100644 --- a/src/fmm.c +++ b/src/fmm.c @@ -3552,7 +3552,7 @@ HSAKMT_STATUS fmm_register_graphics_handle(HSAuint64 GraphicsResourceHandle, HsaMemFlags mflags; vm_object_t *obj; void *metadata; - void *mem, *aperture_base; + void *mem, *aperture_base = NULL; int32_t gpu_mem_id; int r; HSAKMT_STATUS status = HSAKMT_STATUS_ERROR; @@ -3591,7 +3591,6 @@ HSAKMT_STATUS fmm_register_graphics_handle(HSAuint64 GraphicsResourceHandle, aperture = &mem_handle_aperture; } else if (topology_is_svm_needed(gpu_mem[gpu_mem_id].EngineId)) { aperture = svm.dgpu_aperture; - aperture_base = NULL; } else { aperture = &gpu_mem[gpu_mem_id].gpuvm_aperture; aperture_base = aperture->base;