From patchwork Mon Apr 9 21:06:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 10332003 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4563B6022E for ; Mon, 9 Apr 2018 21:06:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 389DF28923 for ; Mon, 9 Apr 2018 21:06:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D1BC28BEC; Mon, 9 Apr 2018 21:06:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 0DB7528923 for ; Mon, 9 Apr 2018 21:06:48 +0000 (UTC) Received: (qmail 28224 invoked by uid 550); 9 Apr 2018 21:06:46 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 28047 invoked from network); 9 Apr 2018 21:06:45 -0000 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=txvQFbkVbneeHk7xGEu3Dvk+9Bxlu6Nrd6YkyLh2pW8=; b=Wy1oosUMXEasaO9v3EKvjn1ZdXWd9On7AjOu+rR1CZgVTIZ3eYR2IwhWw4T0d0nh+A 7Ypo5TFADEuol1wGdNgz/VQGC9vISheVJmKjYYrdtuffExfJ0+PwYDHGmulcXpz0WdDU 0VYDrY9XsXkrfX0p78O6WYWBf3wYVV6MYQ4vTktGdLTsOaDWzSiw2QmuFl/VFBW7x0yw cTPXZ6RgRN71/5qFAbWsX9qYt9rHVm1EA3tZZtR7uAFD8AO8BkN3F917brDbtY+4/WLA 7G/zPlrV21ltKbibHf60w1ksOep6Ga3UQJJxN7Ga9Os01AdZgRXQClHge/X+cBtWxzT5 lotg== X-Gm-Message-State: AElRT7FuzsyVxQFSz2bTmSR4OX5TynedZfF8ru45vurwk1UBptFCYKex HwZsaaknoP3FyMuUQojMDX1iZw== X-Google-Smtp-Source: AIpwx4/ldrV1hOiUscm98kHV3BLn80d+23U74CipqZzO9RXIifC9mqNXdqmD+jVd228oSupmCXy3AQ== X-Received: by 2002:a17:902:ab88:: with SMTP id f8-v6mr40192276plr.34.1523307993940; Mon, 09 Apr 2018 14:06:33 -0700 (PDT) From: Laura Abbott To: Oded Gabbay , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , "David (ChunMing) Zhou" Cc: Laura Abbott , David Airlie , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, Kees Cook Subject: [PATCH] drm/amdkfd: Remove vla Date: Mon, 9 Apr 2018 14:06:20 -0700 Message-Id: <20180409210620.3647-1-labbott@redhat.com> X-Mailer: git-send-email 2.14.3 X-Virus-Scanned: ClamAV using ClamSMTP There's an ongoing effort to remove VLAs[1] from the kernel to eventually turn on -Wvla. The single VLA usage in the amdkfd driver is actually constant across all current platforms. Switch to a constant size array instead. [1] https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Laura Abbott --- drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c | 8 +++++--- 1 file changed, 5 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..c9863858f343 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[4]; - 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 > (4 * sizeof(uint32_t))) { + dev_err(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,