From patchwork Wed Apr 11 01:02:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 10334689 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 5BE60602D8 for ; Wed, 11 Apr 2018 01:03:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59BEA26253 for ; Wed, 11 Apr 2018 01:03:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E0DD285DD; Wed, 11 Apr 2018 01:03:09 +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 8915A26253 for ; Wed, 11 Apr 2018 01:03:08 +0000 (UTC) Received: (qmail 3604 invoked by uid 550); 11 Apr 2018 01:03:06 -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 3574 invoked from network); 11 Apr 2018 01:03:06 -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=vjfMdQW2qqANENkY55bBcrTsKlYRfZRl/r97fU0VU4w=; b=PV7XFH9aat7hFXTX9HftCZO+2UaNipKM+TlSJH6P+LTTVTdgTjaR4gAdkskKlwx5Tz wPWMkltf/kf1HavSqPLHlbF59B5LbxQ0NtHzuxk76MOH6Qg+OoSeyqXeDyuFMzEhqQZP zPAs4spzQdUALJ4JILg6cykPUQAXUbiuZO45ObHDF1PI6TDnuB2r2v3VIf62tBng5MAV H+RRmKzRBENDfhQTO1nGr/jpeWJrxTEubyOuRSbSZUFqXJSn5sQjj2Ms8rTSaVnCACjK jmhxMFf/41EqNuLCFwIwOEr9WXuU+cZd03uRgmPQAv4tZ0MfuaDYEWdycWNwh0e3n2cr g+AA== X-Gm-Message-State: ALQs6tCK/lul6k8g3+W+Brni7iIYnzhhTH/YwXmbbDDCSSzzY5RN/k1p 8TDA/+CJ7TJZkM6BRN+6K4+D8w== X-Google-Smtp-Source: AIpwx49GmhOysqSlFmGp5xMSC6LM+fTX/eaaSjTvaeHBoTHYM3PlDZiUK/ajvcK+4p0xOUUPYr/+rQ== X-Received: by 10.99.146.83 with SMTP id s19mr1894588pgn.104.1523408574356; Tue, 10 Apr 2018 18:02:54 -0700 (PDT) From: Laura Abbott To: Oded Gabbay , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , "David (ChunMing) Zhou" , Felix Kuehling 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: [PATCHv2] drm/amdkfd: Remove vla Date: Tue, 10 Apr 2018 18:02:43 -0700 Message-Id: <20180411010243.17771-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. Switch to a constant value that covers all hardware. [1] https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Laura Abbott --- v2: Switch to a larger size to account for other hardware --- 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..c3a5a80e31ae 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[8]; - 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 > (8 * 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,