From 79a57a6fc1dd4c64d2854ff1cd235329cd60ac49 Mon Sep 17 00:00:00 2001 From: Jaydeep Patel Date: Fri, 16 Feb 2024 06:13:10 +0000 Subject: [PATCH] SWDEV-446219 - Validate option value. Change-Id: Ifccdddfc8ac71585f6ba045578e5bbb7e3cd1649 [ROCm/clr commit: 66f6a3e255f24e5aa9dc72a009684f08c842ede8] --- projects/clr/hipamd/src/hip_vm.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/clr/hipamd/src/hip_vm.cpp b/projects/clr/hipamd/src/hip_vm.cpp index 5df9c41902..73ba16776b 100644 --- a/projects/clr/hipamd/src/hip_vm.cpp +++ b/projects/clr/hipamd/src/hip_vm.cpp @@ -168,7 +168,9 @@ hipError_t hipMemGetAllocationGranularity(size_t* granularity, const hipMemAlloc HIP_INIT_API(hipMemGetAllocationGranularity, granularity, prop, option); if (granularity == nullptr || prop == nullptr || prop->type != hipMemAllocationTypePinned || - prop->location.type != hipMemLocationTypeDevice || prop->location.id >= g_devices.size()) { + prop->location.type != hipMemLocationTypeDevice || prop->location.id >= g_devices.size() || + (option != hipMemAllocationGranularityMinimum && + option != hipMemAllocationGranularityRecommended)) { HIP_RETURN(hipErrorInvalidValue); }