From 4ea3e44ac805b6a8f8de41c4ee6b8b0c50fddf9e Mon Sep 17 00:00:00 2001 From: Jason Tang Date: Fri, 5 Mar 2021 11:34:38 -0500 Subject: [PATCH] SWDEV-275828 - Fix api negative_get_platform_info test Change-Id: Iffbcd4fe3b3b59a072e3374c0af3409338eeeca2 --- opencl/amdocl/cl_common.hpp | 4 ++-- opencl/amdocl/cl_icd.cpp | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/opencl/amdocl/cl_common.hpp b/opencl/amdocl/cl_common.hpp index f41932d963..c61d89d4b2 100644 --- a/opencl/amdocl/cl_common.hpp +++ b/opencl/amdocl/cl_common.hpp @@ -56,8 +56,8 @@ clGetInfo( cl_int ret = CL_SUCCESS; if (param_value != NULL && param_value_size < valueSize) { - if (!std::is_pointer() || !std::is_same::type>::type, char>()) { + if ((param_value_size == 0) || !std::is_pointer() || !std::is_same::type>::type, char>()) { return CL_INVALID_VALUE; } // For char* and char[] params, we will at least fill up to diff --git a/opencl/amdocl/cl_icd.cpp b/opencl/amdocl/cl_icd.cpp index ec2cb48d7d..302a3ffb74 100644 --- a/opencl/amdocl/cl_icd.cpp +++ b/opencl/amdocl/cl_icd.cpp @@ -37,6 +37,10 @@ amd::PlatformIDS amd::PlatformID::Platform = //{ NULL }; static cl_int CL_API_CALL icdGetPlatformInfo(cl_platform_id platform, cl_platform_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { + if (platform != reinterpret_cast(&amd::PlatformID::Platform)) { + return CL_INVALID_PLATFORM; + } + return clGetPlatformInfo(NULL, param_name, param_value_size, param_value, param_value_size_ret); }