From patchwork Mon Apr 9 21:06:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 10331997 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 84BE06022E for ; Mon, 9 Apr 2018 21:06:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 776CF28923 for ; Mon, 9 Apr 2018 21:06:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6BB9328BEC; Mon, 9 Apr 2018 21:06:27 +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 75F5A28923 for ; Mon, 9 Apr 2018 21:06:26 +0000 (UTC) Received: (qmail 26096 invoked by uid 550); 9 Apr 2018 21:06:24 -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 26032 invoked from network); 9 Apr 2018 21:06:23 -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=oOrV9n4ebDhS1W/G4uF4IMdlLq4fzkwhLWhjwpOaIG8=; b=UUjzL1jjPmcqlnBy7KDu2tm4sAE8DbehFK61pOi8Av2xd8lLWKyIKe50i4YYq1EbUM sSI2QrYB/BC8u78laNhMVuMpxE/HlnF060T3qK28mPilmYhsO7nuyQFH26qWZ2Zlq/cE 5RjpdfzEvo9RIpp6SRlShu9SDYPa7ljbv/UtjbnLn0WE4tK5VmuszykfJFVzvfoquCgY EXGId/dEKSPaX7oBX5iHfBMSJCfcwoyZUHOqwKU9L8ov31E7OeSZEalI6oEdB7SBqoG7 FgMp1fXX9n73bLiPdQkUnL0jxfnpP0zp2cByenMsgteyo8l6SYSCw7NMf6iCC6S4YWOm uDaA== X-Gm-Message-State: ALQs6tDWufQQgB+zJf2emUnxrw8AyetDOf4pB/xbPMQSCLIic91w+YlG bHwX/9nUH1UaQWpyCYPBdLudDQ== X-Google-Smtp-Source: AIpwx48V4rnzvLjxycIS6LQq658pX0r8v56OEbR9BpFLWXmAIGRQp/R/RHSyyWP5yLxJVNcZp9pB9w== X-Received: by 10.98.19.132 with SMTP id 4mr394097pft.87.1523307972129; Mon, 09 Apr 2018 14:06:12 -0700 (PDT) From: Laura Abbott To: Vinod Koul , Dan Williams Cc: Laura Abbott , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, Kees Cook Subject: [PATCH] dmaengine: dmatest: Remove use of VLAs Date: Mon, 9 Apr 2018 14:06:03 -0700 Message-Id: <20180409210603.3575-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 from the kernel (https://lkml.org/lkml/2018/3/7/621) to eventually turn on -Wvla. The uses in dmatest are bounded by a check to make sure they fit in a u8 so use that as an upper bound. Signed-off-by: Laura Abbott --- drivers/dma/dmatest.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index 80cc2be6483c..dcf787b173e4 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c @@ -556,7 +556,8 @@ static int dmatest_func(void *data) && !(params->iterations && total_tests >= params->iterations)) { struct dma_async_tx_descriptor *tx = NULL; struct dmaengine_unmap_data *um; - dma_addr_t srcs[src_cnt]; + /* total buffer count must fit into u8 */ + dma_addr_t srcs[255]; dma_addr_t *dsts; unsigned int src_off, dst_off, len; @@ -669,7 +670,8 @@ static int dmatest_func(void *data) srcs, src_cnt, len, flags); else if (thread->type == DMA_PQ) { - dma_addr_t dma_pq[dst_cnt]; + /* dst_cnt can't be more than u8 */ + dma_addr_t dma_pq[255]; for (i = 0; i < dst_cnt; i++) dma_pq[i] = dsts[i] + dst_off;