From 5528812aa90100722740c8c0b516c408db78f31e Mon Sep 17 00:00:00 2001 From: Alex Xie Date: Tue, 5 Apr 2022 16:11:07 -0400 Subject: [PATCH] SWDEV-330240 - HLK pnp with IO stress test fail This code change is to improve error handling. This code change does not fix issue itself. Before this code change, hostcallBuffer_ point is initialized in the end of create() function. If create function fails and returns early, hostcallBuffer_ point is not initialized. This non-initialized point can cause access violation when object is destructed. This code change put the initialization of the pointer in the constructor. Change-Id: I7fb6e764eb0547196dca03db237e49d3ff0fd06a --- rocclr/device/pal/palvirtual.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rocclr/device/pal/palvirtual.cpp b/rocclr/device/pal/palvirtual.cpp index 02a5339d39..b2078cca29 100644 --- a/rocclr/device/pal/palvirtual.cpp +++ b/rocclr/device/pal/palvirtual.cpp @@ -878,6 +878,9 @@ VirtualGPU::VirtualGPU(Device& device) queues_[MainEngine] = nullptr; queues_[SdmaEngine] = nullptr; + + // The hostcall buffer for this vqueue is initialized on demand. + hostcallBuffer_ = nullptr; } bool VirtualGPU::create(bool profiling, uint deviceQueueSize, uint rtCUs, @@ -1035,9 +1038,6 @@ bool VirtualGPU::create(bool profiling, uint deviceQueueSize, uint rtCUs, &dbg_vmid); } - // The hostcall buffer for this vqueue is initialized on demand. - hostcallBuffer_ = nullptr; - return true; }