Skip to content

Commit 534cafc

Browse files
committed
removed possibility of deferencing nullptr arg_value in src/acl_kernel
1 parent 79228be commit 534cafc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/acl_kernel.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,9 @@ CL_API_ENTRY cl_int CL_API_CALL clSetKernelArgIntelFPGA(cl_kernel kernel,
409409
break;
410410

411411
case ACL_ARG_ADDR_NONE:
412+
if (arg_value == 0) {
413+
ERR_RET(CL_INVALID_ARG_VALUE, context, "Argument value is NULL");
414+
}
412415
if (is_sampler && arg_value != 0 &&
413416
acl_sampler_is_valid_ptr(*((cl_sampler *)arg_value))) {
414417
if (arg_size != sizeof(cl_sampler)) {
@@ -425,9 +428,6 @@ CL_API_ENTRY cl_int CL_API_CALL clSetKernelArgIntelFPGA(cl_kernel kernel,
425428
} else if (arg_size != arg_info->size) {
426429
ERR_RET(CL_INVALID_ARG_SIZE, context, "Argument size is the wrong size");
427430
}
428-
if (arg_value == 0) {
429-
ERR_RET(CL_INVALID_ARG_VALUE, context, "Argument value is NULL");
430-
}
431431
break;
432432
}
433433

0 commit comments

Comments
 (0)