diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-09-21 13:13:50 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-09-21 13:17:31 +0200 |
commit | ca3c8526efc57eb90dcb238dd740cfe41df13b31 (patch) | |
tree | df69a47643a1574a12993c9a045f879c8e04586e /opencl | |
parent | 1c856b3e282a43943f25717acd6ebbf6e2225f39 (diff) |
Valgrind reports read of uninitialized bCLBool
...during e.g. CppunitTest_sc_subsequent_filters_test, where
CL_DEVICE_LINKER_AVAILABLE is apparently a later addition (<https://
www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clGetDeviceInfo.html>
mentions it while <https://www.khronos.org/registry/cl/sdk/1.0/docs/man/xhtml/
clGetDeviceInfo.html> doesn't).
Change-Id: Icdaeffa4adb0765a6317f443130fa295761eb93f
Diffstat (limited to 'opencl')
-rw-r--r-- | opencl/inc/opencl_device_selection.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/opencl/inc/opencl_device_selection.h b/opencl/inc/opencl_device_selection.h index 3ed1bd8f3b33..543c6297a108 100644 --- a/opencl/inc/opencl_device_selection.h +++ b/opencl/inc/opencl_device_selection.h @@ -127,7 +127,9 @@ inline OString getDeviceType(cl_device_id aDeviceId) inline bool getDeviceInfoBool(cl_device_id aDeviceId, cl_device_info aDeviceInfo) { - cl_bool bCLBool; + cl_bool bCLBool = 0; + // init to false in case clGetDeviceInfo returns CL_INVALID_VALUE when + // requesting unsupported (in version 1.0) CL_DEVICE_LINKER_AVAILABLE clGetDeviceInfo(aDeviceId, aDeviceInfo, sizeof(bCLBool), &bCLBool, nullptr); return bCLBool == CL_TRUE; } |