[5/6] Fix get kernel_names bug.

Submitted by junyan.he@inbox.com on June 23, 2017, 10:18 a.m.

Details

Message ID 1498213109-10042-5-git-send-email-junyan.he@inbox.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Beignet

Not browsing as part of any series.

Commit Message

junyan.he@inbox.com June 23, 2017, 10:18 a.m.
From: Junyan He <junyan.he@intel.com>

The cl_program_get_kernel_names should use size_t rather than int.

Signed-off-by: Junyan He <junyan.he@intel.com>
---
 runtime/cl_api_program.c | 5 +++--
 runtime/cl_program.c     | 2 +-
 runtime/cl_program.h     | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/runtime/cl_api_program.c b/runtime/cl_api_program.c
index 18f48ce..e4ce5bb 100644
--- a/runtime/cl_api_program.c
+++ b/runtime/cl_api_program.c
@@ -32,8 +32,9 @@  clGetProgramInfo(cl_program program,
   size_t src_size = 0;
   const char *ret_str = "";
   cl_int ref;
-  cl_uint num_dev, kernels_num;
+  cl_uint num_dev;
   cl_int i;
+  size_t kernels_num;
 
   if (!CL_OBJECT_IS_PROGRAM(program)) {
     return CL_INVALID_PROGRAM;
@@ -61,7 +62,7 @@  clGetProgramInfo(cl_program program,
       return err;
 
     src_ptr = &kernels_num;
-    src_size = sizeof(cl_uint);
+    src_size = sizeof(size_t);
   } else if (param_name == CL_PROGRAM_SOURCE) {
     if (!program->source) {
       src_ptr = ret_str;
diff --git a/runtime/cl_program.c b/runtime/cl_program.c
index a9eaedd..a22ee8b 100644
--- a/runtime/cl_program.c
+++ b/runtime/cl_program.c
@@ -656,7 +656,7 @@  cl_program_link(cl_context context, cl_uint num_devices, const cl_device_id *dev
 }
 
 LOCAL cl_int
-cl_program_get_kernel_names(cl_program p, cl_uint *kerne_num, size_t size, char *names, size_t *name_ret)
+cl_program_get_kernel_names(cl_program p, size_t *kerne_num, size_t size, char *names, size_t *name_ret)
 {
   /* This function will get all possible kernel names, at least one device has it */
   char **known_kernel_list = NULL;
diff --git a/runtime/cl_program.h b/runtime/cl_program.h
index 7b2196a..6d4d8d6 100644
--- a/runtime/cl_program.h
+++ b/runtime/cl_program.h
@@ -74,7 +74,7 @@  extern cl_int cl_program_compile(cl_program p, cl_uint num_input_headers, const
 extern cl_program cl_program_link(cl_context context, cl_uint num_devices, const cl_device_id *device_list,
                                   cl_uint num_input_programs, const cl_program *input_programs,
                                   const char *options, cl_int *errcode_ret);
-extern cl_int cl_program_get_kernel_names(cl_program p, cl_uint *kerne_num, size_t size, char *names, size_t *name_ret);
+extern cl_int cl_program_get_kernel_names(cl_program p, size_t *kerne_num, size_t size, char *names, size_t *name_ret);
 extern cl_program cl_program_create_with_built_in_kernles(cl_context context, cl_uint num_devices,
                                                           const cl_device_id *device_list, const char *kernel_names,
                                                           cl_int *errcode_ret);