Received: by 10.213.65.68 with SMTP id h4csp4256098imn; Tue, 10 Apr 2018 11:47:18 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/+3JtRa3h1gasDx8uhhUDbqeYnpH3hN6FPJcH9++FSJxSn1gNezT7tMhTT521fVQ8ACWV+ X-Received: by 10.98.174.5 with SMTP id q5mr1280569pff.155.1523386038102; Tue, 10 Apr 2018 11:47:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523386038; cv=none; d=google.com; s=arc-20160816; b=rKUww1pyiUAQqJAvFsex4COk3Sb8tJaWZeX5cwQ4DYR9oJfHbsbMLBIF1DfodfZusk +7vZw8iPWZRIEq5NyjaMLGaRwh4bGXUkWmozyqI3XR+l19sAaV6tRQ98ne3H8iMe30+Q 5/ESz8PsW2hp9eWCIbmgwSNrQRiWslZlZyXWZm8lDeFIh5hWiu/h+rsF+E+DaHuRE68O cBplq9Dwee2uOt7zvPudq75hZews70XB/nQxyWbz6HPPtSMHOiwCSuBJb0hKZrpDxM3h w8sNsW+unLsrlKfYifCSHieyFu4CI3+dBQOiq4dQ/D92nTZvb6caz196XN7Vugptwl6t LjVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=qERpecjFXs+m0zF8kmY97dW5txJ7lJ5ATLnnXGTVh5o=; b=fMZewrehxqSeie8akigSclO9uVUntrEK7s2f89euFIKtoiPikY9o4/rXDbvn1eEcLU 2basraHLrw3LuBFoF4RKocfaccCxfn5EBkhiZ4aO3CY1MmD4zgQvsfU0GjXvQfYu7RVS QNXi5YUju4ycfV0Z9vbsliCoZhG5mewj+NB8C1T/uksBBcMJunFIPlYCu2mFLA6WyoXM ZNTrDrGcSZXYspxDvEghA+2wd+Xwt4Duvso58grnpoNxkhF/RymA94WN7JoAyIeJTS/T 0CZ4pY9nRT3UVioQ40K7IGMSa1TNxcwdgRBTFPjoaEZpRD/o4xftFsvnLntzhGtf/a2L 1hXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g33-v6si3202020plb.499.2018.04.10.11.46.40; Tue, 10 Apr 2018 11:47:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753342AbeDJSoF (ORCPT + 99 others); Tue, 10 Apr 2018 14:44:05 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:38684 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752103AbeDJSoE (ORCPT ); Tue, 10 Apr 2018 14:44:04 -0400 Received: by mail-pl0-f68.google.com with SMTP id c7-v6so4828563plr.5 for ; Tue, 10 Apr 2018 11:44:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=qERpecjFXs+m0zF8kmY97dW5txJ7lJ5ATLnnXGTVh5o=; b=SALrVhuO4kVCwQF8VLcj5LmqGkrcKRQk7VwT9VuHeUHMKqrLaMdncUMl8TjopMcOAw t2ChLZHTsqui/89TPtuDypyf9Xi6GRgzukrU2mfDWULUhhkUfLbg8XhqjtpOQDXepKHW xjo19n0+2UXwlXZZX4LB1K6YyGRLiGnIb4yKHK4M+XDAL3fXhbWsFkRtvnyc9SfSaLWp WN9EpfrP//7Tm0UF8qrNbAfwhOilGWb2fdI9dJAG8DFUVxNvEVoefZCTyrgHqaCCOxnt Bhziuit8BQzOul7hAOhTsUBkf7lK5WgP7STcKx3Uh67QS+f2p3nCyD0iUcB4MBtZW6BH +UEQ== X-Gm-Message-State: ALQs6tC0z3vifxemtNHrh7ollfgKTTIyMOSEV4kuCHsU8KXVt8+/LxRP 3TwUQxvDAy3tsiWyISAQ2eIetCF7+rM= X-Received: by 2002:a17:902:5681:: with SMTP id j1-v6mr1566955pli.383.1523385843913; Tue, 10 Apr 2018 11:44:03 -0700 (PDT) Received: from ?IPv6:2601:602:9802:a8dc:4eb2:6dae:ab32:e5b0? ([2601:602:9802:a8dc:4eb2:6dae:ab32:e5b0]) by smtp.gmail.com with ESMTPSA id w26sm9258416pfi.17.2018.04.10.11.43.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Apr 2018 11:44:02 -0700 (PDT) Subject: Re: [PATCH] drm/amdkfd: Remove vla To: =?UTF-8?Q?Christian_K=c3=b6nig?= , Oded Gabbay , Alex Deucher , "David (ChunMing) Zhou" Cc: David Airlie , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, Kees Cook References: <20180409210620.3647-1-labbott@redhat.com> <71ff5078-713c-ff8b-8c8d-6d24a7d84c02@amd.com> From: Laura Abbott Message-ID: <7aba566e-ed84-91ae-78f1-01659ef7907d@redhat.com> Date: Tue, 10 Apr 2018 11:43:57 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <71ff5078-713c-ff8b-8c8d-6d24a7d84c02@amd.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/09/2018 11:38 PM, Christian König wrote: > Am 09.04.2018 um 23:06 schrieb Laura Abbott: >> 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. > > Actually that isn't correct. > > Could be that we haven't upstreamed KFD support for them, but Vega10 have a different interrupt ring entry size and so would cause the error message here. > >> Switch to a constant size array >> instead. > > I would say to just make make the array bigger. > > Regards, > Christian. > What array size would accommodate future chips? >> >> [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, >