Skip to content

Commit b3e84c6

Browse files
committed
Check pointer 'kern->accel_queue_back' for NULL before dereferencing
----------------------------------------------------------------------------- Pointer 'kern->accel_queue_back' returned from call to function 'acl_malloc' at line 955 may be NULL and will be dereferenced at line 965
1 parent 088ddd0 commit b3e84c6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/acl_kernel_if.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,10 @@ int acl_kernel_if_update(const acl_device_def_autodiscovery_t &devdef,
978978
return 1;
979979
}
980980
kern->accel_queue_back = (int *)acl_malloc(kern->num_accel * sizeof(int));
981+
if (!(kern->accel_queue_back)) {
982+
ACL_KERNEL_IF_DEBUG_MSG(kern, "Failed to allocate memory for kernel IRQ circular buffer.\n");
983+
return 1;
984+
}
981985

982986
for (unsigned a = 0; a < kern->num_accel; ++a) {
983987
unsigned int max_same_accel_launches =

0 commit comments

Comments
 (0)