summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2022-04-21 09:47:26 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2022-04-21 09:47:26 +0000
commit7ec74be4e269ec05edeb24d9e40c2d69508b94b4 (patch)
tree392b845b512ec2c1720a7f3952ea29c194ad0340
parent1d3f244114c88151e494b9c8110263b17239dc78 (diff)
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
-rw-r--r--sys/dev/pci/drm/amd/amdkfd/kfd_events.c2
1 files changed, 2 insertions, 0 deletions
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);