From 11f97823cde4022474654ceb92d6cb6532bd0be1 Mon Sep 17 00:00:00 2001 From: sdashmiz Date: Mon, 9 Jan 2023 10:54:08 -0500 Subject: [PATCH] SWDEV-374374 - memset memory mapping should not change Signed-off-by: sdashmiz Change-Id: I4cc3b1ac5a59fe5c9ae060f4d5d189dc63ca450c [ROCm/clr commit: 52bf09aac6d7923a47079940847b5ca0406a4a78] --- projects/clr/hipamd/src/hip_graph_internal.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/projects/clr/hipamd/src/hip_graph_internal.hpp b/projects/clr/hipamd/src/hip_graph_internal.hpp index 65ccfdc341..838312e890 100644 --- a/projects/clr/hipamd/src/hip_graph_internal.hpp +++ b/projects/clr/hipamd/src/hip_graph_internal.hpp @@ -1578,6 +1578,8 @@ class hipGraphMemsetNode : public hipGraphNode { hipError_t SetParams(const hipMemsetParams* params) { hipError_t hip_error = hipSuccess; + hipMemsetParams origParams = {}; + GetParams(&origParams); hip_error = ihipGraphMemsetParams_validate(params); if (hip_error != hipSuccess) { return hip_error; @@ -1585,9 +1587,15 @@ class hipGraphMemsetNode : public hipGraphNode { size_t sizeBytes; if (params->height == 1) { sizeBytes = params->width * params->elementSize; + if (sizeBytes != origParams.width * origParams.elementSize) { + return hipErrorInvalidValue; + } hip_error = ihipMemset_validate(params->dst, params->value, params->elementSize, sizeBytes); } else { sizeBytes = params->width * params->height * 1; + if (sizeBytes != origParams.width * origParams.height * 1) { + return hipErrorInvalidValue; + } hip_error = ihipMemset3D_validate({params->dst, params->pitch, params->width * params->elementSize, params->height}, params->value, {params->width * params->elementSize, params->height, 1}, sizeBytes);