Skip to content

Commit ccbefac

Browse files
IlanTruanovskypcolberg
authored andcommitted
Fix Coverity ARRAY_VS_SINGLETON issues
Many functions that eventually call acl_check_events_in_context have this Coverity issue. What Coverity detects is a false positive. It believes we are adding to a pointer that points to a single element, making that pointer point to unknown data. However, it's impossible for this to actually happen. These changes silence the Coverity issues by instead of passing a pointer to a single element, passing in an array of size 1.
1 parent 2834ca2 commit ccbefac

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

test/acl_mem_test.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2654,9 +2654,10 @@ MT_TEST(acl_mem, fill_image) {
26542654
CHECK_EQUAL(CL_INVALID_EVENT_WAIT_LIST,
26552655
clEnqueueFillImage(m_cq, image, fill_color_int, origin, region,
26562656
1, NULL, &fill_event)); // invalid wait list
2657+
cl_event event_wait_list[1];
26572658
CHECK_EQUAL(CL_INVALID_EVENT_WAIT_LIST,
26582659
clEnqueueFillImage(m_cq, image, fill_color_int, origin, region,
2659-
0, &fill_event,
2660+
0, event_wait_list,
26602661
&fill_event)); // invalid wait list
26612662

26622663
CHECK_EQUAL(1, acl_ref_count(image));

test/acl_svm_test.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,9 @@ MT_TEST(acl_svm, memfill_svm) {
463463
CHECK_EQUAL(CL_INVALID_COMMAND_QUEUE, status);
464464

465465
// Invalid wait list
466+
cl_event event_wait_list[1];
466467
status = clEnqueueSVMMemFill(m_cq, dst_ptr, &pattern, sizeof(int),
467-
10 * sizeof(int), 0, &event, NULL);
468+
10 * sizeof(int), 0, event_wait_list, NULL);
468469
CHECK_EQUAL(CL_INVALID_EVENT_WAIT_LIST, status);
469470
status = clEnqueueSVMMemFill(m_cq, dst_ptr, &pattern, sizeof(int),
470471
10 * sizeof(int), 1, NULL, NULL);

test/acl_usm_test.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,8 +1135,10 @@ MT_TEST(acl_usm, memfill_usm) {
11351135
CHECK_EQUAL(CL_INVALID_COMMAND_QUEUE, status);
11361136

11371137
// Invalid wait list
1138-
status = clEnqueueMemFillINTEL(m_cq, dev_ptr, &pattern, sizeof(int),
1139-
testsize * sizeof(int), 0, &event, NULL);
1138+
cl_event event_wait_list[1];
1139+
status =
1140+
clEnqueueMemFillINTEL(m_cq, dev_ptr, &pattern, sizeof(int),
1141+
testsize * sizeof(int), 0, event_wait_list, NULL);
11401142
CHECK_EQUAL(CL_INVALID_EVENT_WAIT_LIST, status);
11411143
status = clEnqueueMemFillINTEL(m_cq, dev_ptr, &pattern, sizeof(int),
11421144
testsize * sizeof(int), 1, NULL, NULL);

0 commit comments

Comments
 (0)