[Libreoffice-commits] core.git: opencl/inc

Stephan Bergmann sbergman at redhat.com
Wed Sep 21 11:19:24 UTC 2016


 opencl/inc/opencl_device_selection.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit ca3c8526efc57eb90dcb238dd740cfe41df13b31
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Sep 21 13:13:50 2016 +0200

    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

diff --git a/opencl/inc/opencl_device_selection.h b/opencl/inc/opencl_device_selection.h
index 3ed1bd8..543c629 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;
 }


More information about the Libreoffice-commits mailing list