[Beignet] [PATCH 1/2] runtime: extension size not enough.

xionghu.luo at intel.com xionghu.luo at intel.com
Mon Nov 9 22:48:24 PST 2015


From: Meng Mengmeng <mengmeng.meng at intel.com>

define a MACRO to hold the value.

Signed-off-by: Luo Xionghu <xionghu.luo at intel.com>
---
 src/cl_device_id.h  | 4 +++-
 src/cl_extensions.c | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/cl_device_id.h b/src/cl_device_id.h
index 4a923ef..3e90e62 100644
--- a/src/cl_device_id.h
+++ b/src/cl_device_id.h
@@ -20,6 +20,8 @@
 #ifndef __CL_DEVICE_ID_H__
 #define __CL_DEVICE_ID_H__
 
+#define EXTENSTION_LENGTH 512
+
 /* Store complete information about the device */
 struct _cl_device_id {
   DEFINE_ICD(dispatch)
@@ -95,7 +97,7 @@ struct _cl_device_id {
   const char *version;
   const char *profile;
   const char *opencl_c_version;
-  const char extensions[256];
+  const char extensions[EXTENSTION_LENGTH];
   const char *driver_version;
   const char *spir_versions;
   const char *built_in_kernels;
diff --git a/src/cl_extensions.c b/src/cl_extensions.c
index 3e714ac..ede4278 100644
--- a/src/cl_extensions.c
+++ b/src/cl_extensions.c
@@ -140,7 +140,7 @@ cl_intel_platform_enable_extension(cl_device_id device, uint32_t ext)
       memcpy((char*)device->extensions, ext_str, strlen(ext_str));
       device->extensions_sz = strlen(ext_str) + 1;
     } else {
-      assert(device->extensions_sz + 1 + strlen(ext_str) < 256);
+      assert(device->extensions_sz + 1 + strlen(ext_str) < EXTENSTION_LENGTH);
       *(char*)(device->extensions + device->extensions_sz - 1) = ' ';
       memcpy((char*)device->extensions + device->extensions_sz, ext_str, strlen(ext_str));
       device->extensions_sz = device->extensions_sz + strlen(ext_str) + 1;
-- 
1.9.1



More information about the Beignet mailing list