From: Junyan He <[email protected]>

There is no NULL pointer check for kernel->program->build_opts.
This will cause utest test_get_arg_info crash.
In fact, we will add -cl-kernel-arg-info flag for compiling
ever time, and so the arg info is always avaible.
But some test case deliberately unset this flag and expect the ERR
return value, so we really need a check here.

Signed-off-by: Junyan He <[email protected]>
---
 src/cl_api.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/cl_api.c b/src/cl_api.c
index d1d7a09..dbbcbb0 100644
--- a/src/cl_api.c
+++ b/src/cl_api.c
@@ -1251,7 +1251,8 @@ cl_int clGetKernelArgInfo(cl_kernel kernel, cl_uint 
arg_index, cl_kernel_arg_inf
   cl_int err = CL_SUCCESS;
   CHECK_KERNEL(kernel);
 
-  if(strstr(kernel->program->build_opts,"-cl-kernel-arg-info") == NULL ) {
+  if(kernel->program->build_opts == NULL ||
+        strstr(kernel->program->build_opts,"-cl-kernel-arg-info") == NULL ) {
     err = CL_KERNEL_ARG_INFO_NOT_AVAILABLE;
     goto error;
   }
-- 
1.9.1

_______________________________________________
Beignet mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/beignet

Reply via email to