summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2015-01-18 23:24:04 +0100
committerSylvain Munaut <tnt@246tNt.com>2015-01-18 23:35:51 +0100
commit95f603cc513c9fb33cfcf4558d0befe4d24f8448 (patch)
treead04f895587c4a352b2c302e9f2472c818471e71
parentb1ec76c2f4ea0e0160d0207216e5c2c9b3c77a8f (diff)
fosphor/cl: Fix overflow when querying local_mem size
CL_DEVICE_LOCAL_MEM_SIZE is an unsigned long and can be quite large. Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
-rw-r--r--lib/fosphor/cl.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/fosphor/cl.c b/lib/fosphor/cl.c
index f939f0d..7658d39 100644
--- a/lib/fosphor/cl.c
+++ b/lib/fosphor/cl.c
@@ -61,7 +61,7 @@ struct fosphor_cl_features
cl_device_type type;
char vendor[128];
- int local_mem;
+ unsigned long local_mem;
int flags;
int wg_size;
int wg_size_dim[2];
@@ -145,12 +145,10 @@ cl_device_query(cl_device_id dev_id, struct fosphor_cl_features *feat)
return -1;
/* Local memory size */
- err = clGetDeviceInfo(dev_id, CL_DEVICE_LOCAL_MEM_SIZE, sizeof(cl_ulong), &lmem, NULL);
+ err = clGetDeviceInfo(dev_id, CL_DEVICE_LOCAL_MEM_SIZE, sizeof(cl_ulong), &feat->local_mem, NULL);
if (err != CL_SUCCESS)
return -1;
- feat->local_mem = lmem;
-
/* CL/GL extension */
err = clGetDeviceInfo(dev_id, CL_DEVICE_EXTENSIONS, sizeof(txt)-1, txt, NULL);
if (err != CL_SUCCESS)