Skip to content

Commit 11bb001

Browse files
sherry-yuanpcolberg
authored andcommitted
Check pointer 'kern->accel_queue_front' for NULL before dereferencing
Pointer 'kern->accel_queue_front' returned from call to function 'acl_malloc' at line 954 may be NULL and will be dereferenced at line 964
1 parent a4fdab1 commit 11bb001

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/acl_kernel_if.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,7 @@ int acl_kernel_if_update(const acl_device_def_autodiscovery_t &devdef,
958958
// Kernel IRQ is a separate thread. Need to use circular buffer to make this
959959
// multithread safe.
960960
kern->accel_queue_front = (int *)acl_malloc(kern->num_accel * sizeof(int));
961+
assert(kern->accel_queue_front);
961962
kern->accel_queue_back = (int *)acl_malloc(kern->num_accel * sizeof(int));
962963

963964
for (unsigned a = 0; a < kern->num_accel; ++a) {

0 commit comments

Comments
 (0)