From: jsg Date: Thu, 21 Apr 2022 09:47:25 +0000 (+0000) Subject: drm/amdkfd: Check for potential null return of kmalloc_array() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=01a0a85a4e0fb4c12f9fa644584090fbd35d5a29;p=openbsd drm/amdkfd: Check for potential null return of kmalloc_array() From QintaoShen f2658d5966bcee8c3eb487875f459756d4f7cdfc in linux 5.15.y/5.15.35 ebbb7bb9e80305820dc2328a371c1b35679f2667 in mainline linux --- diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_events.c b/sys/dev/pci/drm/amd/amdkfd/kfd_events.c index 3eea4edee35..b8bdd796cd9 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_events.c +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_events.c @@ -531,6 +531,8 @@ static struct kfd_event_waiter *alloc_event_waiters(uint32_t num_events) event_waiters = kmalloc_array(num_events, sizeof(struct kfd_event_waiter), GFP_KERNEL); + if (!event_waiters) + return NULL; for (i = 0; (event_waiters) && (i < num_events) ; i++) { init_wait(&event_waiters[i].wait);