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: 10332001 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 844516020F for ; Mon, 9 Apr 2018 21:06:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 75D0528923 for ; Mon, 9 Apr 2018 21:06:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A09128BEC; Mon, 9 Apr 2018 21:06:39 +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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 089BD28BD0 for ; Mon, 9 Apr 2018 21:06:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B52A06E2C9; Mon, 9 Apr 2018 21:06:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl0-f66.google.com (mail-pl0-f66.google.com [209.85.160.66]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4CD206E2BF for ; Mon, 9 Apr 2018 21:06:34 +0000 (UTC) Received: by mail-pl0-f66.google.com with SMTP id e22-v6so4189543plj.12 for ; Mon, 09 Apr 2018 14:06:34 -0700 (PDT) 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=f//ZDE3Ffz1W+v4q5a1WM9AN1U4rsxJCKTTpnheCOPqp3FsTFAKQdQ1LFXzYVZ0nNf fs0fwK8zs7gC7+p4r3bUn+L8xgTIb6GiPlD/8phJnRGviHm0+5OdXGt61dHMbkzQavTU fr955VP94h/OJZn7CwaDrBP0137rGz1K4AqFZKjeCf/4qHRPoPGEv03cPZLKf21r78yw 4TEBhGte3FzhBvr6MKAidm9NXhJ7t6YLVHrc/2NJYNOhyMY+gmVChnccg/CokZMDCIMa uLY17EWtfOvtXD8eE30toI7VbURyxFFb2h9osBZNTsUWqkP8O4K9DYtFYacw/Z1zy2CH yEdQ== X-Gm-Message-State: AElRT7ETVExoNeM0bnQo60DzzJw9FkaHB6ityC380oVGY8aZD/waYL8u vookud7McX0OeOvhlqgp5TUK2w== 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) Received: from labbott-redhat.redhat.com ([2601:602:9802:a8dc::1082]) by smtp.gmail.com with ESMTPSA id g11sm1934460pgu.56.2018.04.09.14.06.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Apr 2018 14:06:32 -0700 (PDT) From: Laura Abbott To: Oded Gabbay , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , "David (ChunMing) Zhou" 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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kees Cook , kernel-hardening@lists.openwall.com, David Airlie , linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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,