Skip to content

Fix Coverity issues for acl_hal_test.cpp #260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions test/acl_hal_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include <CL/opencl.h>

#include <cinttypes>
#include <stdarg.h>
#include <stdio.h>

Expand Down Expand Up @@ -391,7 +392,7 @@ void acltest_hal_copy_hostmem_to_hostmem(cl_event event, const void *src,
acltest_hal_event_callback(
event, CL_RUNNING); // in "real life" this in response to a hw message
size_t i;
acl_print_debug_msg(" Copying %d bytes from %p to %p event %p\n", size, src,
acl_print_debug_msg(" Copying %zu bytes from %p to %p event %p\n", size, src,
dest, event);
for (i = 0; i < size; i++) {
((char *)dest)[i] = ((char *)src)[i];
Expand Down Expand Up @@ -663,7 +664,7 @@ void *acltest_translate_device_address(const void *device_ptr, size_t offset) {
}

uintptr_t max_dev_addr = 0xfffffff & ((uintptr_t)device_ptr + offset);
acl_print_debug_msg("maxdevaddr %p\n", max_dev_addr);
acl_print_debug_msg("maxdevaddr %" PRIuPTR "\n", max_dev_addr);
if (!acltest_hal_device_mem || max_dev_addr >= acltest_hal_device_mem_size) {
if (!acltest_hal_device_mem) {
acltest_hal_device_mem = acl_malloc(max_dev_addr + 1);
Expand Down