From 42e94173dfc77c8d7ee9339771ef9a19d1d75a62 Mon Sep 17 00:00:00 2001 From: "Yang, Hao Xiang" Date: Mon, 5 Dec 2022 11:54:16 -0800 Subject: [PATCH 1/2] Fixed coverity issue in acl_kernel.cpp: Type: Invalid type in argument to printf format specifier (PRINTF_ARGS) `local_work_size[idim]` is of type `size_t` therefore using `%zu` instead of `%d`. --- src/acl_kernel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/acl_kernel.cpp b/src/acl_kernel.cpp index a20f7dc5..8c7b9f4d 100644 --- a/src/acl_kernel.cpp +++ b/src/acl_kernel.cpp @@ -1843,7 +1843,7 @@ static cl_int l_enqueue_kernel_with_type( for (idim = 0; idim < work_dim; idim++) { unsigned int kernel_max_global_work_dim; size_t kernel_compile_work_group_size_idim; - acl_print_debug_msg(" local work size[%d] = %d\n", idim, + acl_print_debug_msg(" local work size[%d] = %zu\n", idim, local_work_size[idim]); // If the work group size was specified in the kernel source, then // it must match the passed-in size. If the kernel is workgroup invariant, From 2532834537cc2b48148114e29ffbf6fd7b3c01dc Mon Sep 17 00:00:00 2001 From: "Yang, Hao Xiang" Date: Mon, 5 Dec 2022 12:40:15 -0800 Subject: [PATCH 2/2] Fixed coverity issue in acl_kernel.cpp: Type: Uninitialized scalar variable (UNINIT) Function `l_copy_and_adjust_arguments_for_device` at `line 2164` uses `memory_migration.num_mem_objects`, but `memory_migration` has only been declared up until this point. I assume that since there has been no changes to `memory_migration`, upon declaration, the `num_mem_objects` should be set to 0. This assumption is reinforced by the second occurrence of `l_copy_and_adjust_arguments_for_device` at `line 2228` where `memory_migration.num_mem_objects = 0` is been initialized a few lines before. --- src/acl_kernel.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/acl_kernel.cpp b/src/acl_kernel.cpp index 8c7b9f4d..f90b1770 100644 --- a/src/acl_kernel.cpp +++ b/src/acl_kernel.cpp @@ -1661,6 +1661,7 @@ static cl_int l_enqueue_kernel_with_type( acl_dev_kernel_invocation_image_t *invocation = 0; cl_context context; acl_mem_migrate_t memory_migration; + memory_migration.num_mem_objects = 0; cl_int status = CL_SUCCESS; int serialization_needed = 0; acl_assert_locked();