From 83957f599ef5bea82ceccaa2972ef2b4b0e0bd65 Mon Sep 17 00:00:00 2001 From: agodavar Date: Wed, 27 Jan 2021 10:48:16 -0500 Subject: [PATCH] SWDEV-269400 - handle nullptr in hipFuncGetAttributes and blockSizeLimit<0 in hipModuleOccupancyMaxPotentialBlockSize Change-Id: Ia1c6e5713f40876b4a9c7a1c56b7b3a589c4497a [ROCm/hip commit: 464cad2751556cdd513a06cc2d8c5913fd2322b1] --- projects/hip/rocclr/hip_platform.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/hip/rocclr/hip_platform.cpp b/projects/hip/rocclr/hip_platform.cpp index 0dcfacdfe9..af83db0b40 100755 --- a/projects/hip/rocclr/hip_platform.cpp +++ b/projects/hip/rocclr/hip_platform.cpp @@ -298,7 +298,7 @@ hipError_t ihipOccupancyMaxActiveBlocksPerMultiprocessor( const device::Kernel::WorkGroupInfo* wrkGrpInfo = kernel.getDeviceKernel(device)->workGroupInfo(); if (bCalcPotentialBlkSz == false) { - if (inputBlockSize == 0) { + if (inputBlockSize <= 0) { return hipErrorInvalidValue; } *bestBlockSize = 0; @@ -311,7 +311,7 @@ hipError_t ihipOccupancyMaxActiveBlocksPerMultiprocessor( } else { if (inputBlockSize > int(device.info().maxWorkGroupSize_) || - inputBlockSize == 0) { + inputBlockSize <= 0) { // The user wrote the kernel to work with a workgroup size // bigger than this hardware can support. Or they do not care // about the size So just assume its maximum size is @@ -858,6 +858,9 @@ hipError_t PlatformState::getStatFunc(hipFunction_t* hfunc, const void* hostFunc } hipError_t PlatformState::getStatFuncAttr(hipFuncAttributes* func_attr, const void* hostFunction, int deviceId) { + if(func_attr == nullptr || hostFunction == nullptr) { + return hipErrorInvalidValue; + } return statCO_.getStatFuncAttr(func_attr, hostFunction, deviceId); }