From 942ecdf647055b1d419316af3f61d9f0f0bb5855 Mon Sep 17 00:00:00 2001
From: foreman
Date: Wed, 18 Sep 2019 11:49:40 -0400
Subject: [PATCH] P4 to Git Change 2000398 by gandryey@gera-hip-lnx on
2019/09/18 11:42:00
SWDEV-79445 - OCL generic changes and code clean-up
- Add a check for invalid arguments in the P2P device quiery
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_device.cpp#74 edit
---
opencl/api/opencl/amdocl/cl_device.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/opencl/api/opencl/amdocl/cl_device.cpp b/opencl/api/opencl/amdocl/cl_device.cpp
index cd4ae29152..b841a43486 100644
--- a/opencl/api/opencl/amdocl/cl_device.cpp
+++ b/opencl/api/opencl/amdocl/cl_device.cpp
@@ -417,9 +417,11 @@ RUNTIME_ENTRY(cl_int, clGetDeviceInfo,
case CL_DEVICE_P2P_DEVICES_AMD: {
uint valueSize = as_amd(device)->p2pDevices_.size() * sizeof(cl_device_id);
if (param_value != NULL) {
- if (param_value_size < valueSize) {
+ if ((param_value_size < valueSize) || (param_value_size == 0)) {
return CL_INVALID_VALUE;
}
+ } else {
+ return CL_INVALID_VALUE;
}
memcpy(param_value, as_amd(device)->p2pDevices_.data(), valueSize);
*not_null(param_value_size_ret) = valueSize;