From 6f6ee9679c5c5da0f5daf8520b82b9d221c69b0e Mon Sep 17 00:00:00 2001 From: Apurv Mishra Date: Fri, 22 Nov 2024 16:38:39 -0500 Subject: [PATCH] rocr: uninitialized pointer read in InitScratchPool Initialized 'scratch_base' as a nullptr to avoid uninitialized read in hsaKmtAllocMemory() Change-Id: I3b0e67f3fd3b591e1d21d691f0777b1d1a059b73 Signed-off-by: Apurv Mishra --- runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp b/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp index 8abec94838..b2270be8f2 100644 --- a/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp +++ b/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp @@ -555,7 +555,7 @@ void GpuAgent::InitScratchPool() { } #endif - void* scratch_base; + void* scratch_base = nullptr; HSAKMT_STATUS err = hsaKmtAllocMemory(node_id(), max_scratch_len, flags, &scratch_base); assert(err == HSAKMT_STATUS_SUCCESS && "hsaKmtAllocMemory(Scratch) failed");