From 8a48c8a0e01e9346aa5746ad66a67076c7d5fed0 Mon Sep 17 00:00:00 2001 From: Sarbojit Sarkar Date: Fri, 29 Jan 2021 05:15:40 -0500 Subject: [PATCH] SWDEV-270630 - Added missing nullcheck Change-Id: I7caf26c59c4660e26b4159da35731c2ce1600819 [ROCm/clr commit: 3f5fb8e9dffb591b6167232ee5e6802051caf0ed] --- projects/clr/hipamd/rocclr/hip_texture.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/clr/hipamd/rocclr/hip_texture.cpp b/projects/clr/hipamd/rocclr/hip_texture.cpp index 112f3399f5..e656eef2e4 100755 --- a/projects/clr/hipamd/rocclr/hip_texture.cpp +++ b/projects/clr/hipamd/rocclr/hip_texture.cpp @@ -77,6 +77,11 @@ hipError_t ihipCreateTextureObject(hipTextureObject_t* pTexObject, amd::Device* device = hip::getCurrentDevice()->devices()[0]; const device::Info& info = device->info(); + // Validate input params + if (pTexObject == nullptr || pResDesc == nullptr || pTexDesc == nullptr) { + return hipErrorInvalidValue; + } + // pResViewDesc can only be specified if the type of resource is a HIP array or a HIP mipmapped array. if ((pResViewDesc != nullptr) && ((pResDesc->resType != hipResourceTypeArray) && (pResDesc->resType != hipResourceTypeMipmappedArray))) {