From a73d1a1fe02adeee5b5f43d1f078b517d108f4e1 Mon Sep 17 00:00:00 2001 From: Sarbojit Sarkar Date: Thu, 15 Oct 2020 04:26:03 -0400 Subject: [PATCH] SWDEV-256325 : Fix for hipMemset2D crash Change-Id: I1f434602fecd4fb935d2bc72f2c72d6a2d4c45fe --- hipamd/rocclr/hip_memory.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hipamd/rocclr/hip_memory.cpp b/hipamd/rocclr/hip_memory.cpp index 75f9fe3426..87064b8ee1 100755 --- a/hipamd/rocclr/hip_memory.cpp +++ b/hipamd/rocclr/hip_memory.cpp @@ -1855,6 +1855,10 @@ hipError_t ihipMemset3D(hipPitchedPtr pitchedDevPtr, auto sizeBytes = extent.width * extent.height * extent.depth; + if (sizeBytes == 0) { + // sizeBytes is zero hence returning early as nothing to be set + return hipSuccess; + } if (memory == nullptr) { return hipErrorInvalidValue; }