From d1313330ed4a2d69164f604812d03ff8387e26fc Mon Sep 17 00:00:00 2001 From: jsg Date: Tue, 28 Mar 2023 04:05:41 +0000 Subject: [PATCH] drm/amdkfd: Fix an illegal memory access From Qu Huang d9923e7214a870b312bf61f6a89c7554d0966985 in linux-6.1.y/6.1.21 4fc8fff378b2f2039f2a666d9f8c570f4e58352c in mainline linux --- sys/dev/pci/drm/amd/amdkfd/kfd_events.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_events.c b/sys/dev/pci/drm/amd/amdkfd/kfd_events.c index 729d26d648a..2880ed96ac2 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_events.c +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_events.c @@ -778,16 +778,13 @@ static struct kfd_event_waiter *alloc_event_waiters(uint32_t num_events) struct kfd_event_waiter *event_waiters; uint32_t i; - event_waiters = kmalloc_array(num_events, - sizeof(struct kfd_event_waiter), - GFP_KERNEL); + event_waiters = kcalloc(num_events, sizeof(struct kfd_event_waiter), + GFP_KERNEL); if (!event_waiters) return NULL; - for (i = 0; (event_waiters) && (i < num_events) ; i++) { + for (i = 0; i < num_events; i++) init_wait(&event_waiters[i].wait); - event_waiters[i].activated = false; - } return event_waiters; } -- 2.20.1