|
Message-ID: <CAGXu5jJW2h4PqMkRFEc1G1yqxXm+oZyDfE13pkVxJJjDw6XS3A@mail.gmail.com> Date: Wed, 2 May 2018 14:49:34 -0700 From: Kees Cook <keescook@...omium.org> To: Oded Gabbay <oded.gabbay@...il.com> Cc: Laura Abbott <labbott@...hat.com>, Alex Deucher <alexander.deucher@....com>, Christian König <christian.koenig@....com>, "David (ChunMing) Zhou" <David1.Zhou@....com>, Felix Kuehling <felix.kuehling@....com>, David Airlie <airlied@...ux.ie>, Maling list - DRI developers <dri-devel@...ts.freedesktop.org>, amd-gfx list <amd-gfx@...ts.freedesktop.org>, LKML <linux-kernel@...r.kernel.org>, Kernel Hardening <kernel-hardening@...ts.openwall.com> Subject: Re: [PATCHv3] drm/amdkfd: Remove vla On Fri, Apr 13, 2018 at 2:24 PM, Laura Abbott <labbott@...hat.com> wrote: > > There's an ongoing effort to remove VLAs[1] from the kernel to eventually > turn on -Wvla. Switch to a constant value that covers all hardware. > > [1] https://lkml.org/lkml/2018/3/7/621 > > Reviewed-by: Felix Kuehling <Felix.Kuehling@....com> > Acked-by: Christian König <christian.koenig@....com> > Signed-off-by: Laura Abbott <labbott@...hat.com> Friendly ping -- I don't see this in -next yet. Oded, does this look okay to apply? Thanks! -Kees > --- > v3: Introduced a #define for the max value, switched to pr_err_once to > avoid log flood, switched to sizeof(array) per private suggestion. > --- > drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c | 8 +++++--- > drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 2 ++ > 2 files changed, 7 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c > index 035c351f47c5..db6d9336b80d 100644 > --- a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c > @@ -139,10 +139,12 @@ static void interrupt_wq(struct work_struct *work) > { > struct kfd_dev *dev = container_of(work, struct kfd_dev, > interrupt_work); > + uint32_t ih_ring_entry[KFD_MAX_RING_ENTRY_SIZE]; > > - uint32_t ih_ring_entry[DIV_ROUND_UP( > - dev->device_info->ih_ring_entry_size, > - sizeof(uint32_t))]; > + if (dev->device_info->ih_ring_entry_size > sizeof(ih_ring_entry)) { > + dev_err_once(kfd_chardev(), "Ring entry too small\n"); > + return; > + } > > while (dequeue_ih_ring_entry(dev, ih_ring_entry)) > dev->device_info->event_interrupt_class->interrupt_wq(dev, > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h > index 96a9cc0f02c9..a90db05dfe61 100644 > --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h > @@ -39,6 +39,8 @@ > > #include "amd_shared.h" > > +#define KFD_MAX_RING_ENTRY_SIZE 8 > + > #define KFD_SYSFS_FILE_MODE 0444 > > #define KFD_MMAP_DOORBELL_MASK 0x8000000000000ull > -- > 2.14.3 > -- Kees Cook Pixel Security
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.