From 7ec74be4e269ec05edeb24d9e40c2d69508b94b4 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 21 Apr 2022 09:47:26 +0000 Subject: 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 --- sys/dev/pci/drm/amd/amdkfd/kfd_events.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sys/dev') 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); -- cgit v1.2.3