Received: by 10.192.165.156 with SMTP id m28csp138181imm; Tue, 10 Apr 2018 18:16:47 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+R8QITqjjdZdA94ioDCrd3GCPaRpHZFsXtiJpgUJiWZPKpuUIc3xurwp32kaup5vTvciXX X-Received: by 2002:a17:902:6786:: with SMTP id g6-v6mr2707329plk.362.1523409407927; Tue, 10 Apr 2018 18:16:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523409407; cv=none; d=google.com; s=arc-20160816; b=bJOWmjOgzK3bhX3aU+AoO3oCpDnnbCxWd40Y04UO+0wrh5CT8vxobgmsQTzTfIbUxV /ZMo9LKU3vQa4YQE0UtmRWNfpn8NobCAJZFryLIy3Fw/oxP55eH89DJ1BQOVn5EBfoyG 1kBWrX9JVI32FvVRIgnHKrzOkNRQP3q5Jx82SBVW1IhRiraHS6GSznhJo3qqoijDO/HY v7DWdEUj8NeqvETbbnDIvvIMSf+q0z8F45mbGTni+qAx2buJAyae+Q/i1zKqlmFN2AhT Ba0hR1WMXUveLJSQPhqDsURY5tIhMrVpjIZ5mZ6rbyG2KPS5wR0ppn5VSUCaebQ/+jA0 1Ryg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=wKq7BowXlYKx0270E2z2yatGRuasNAfpSUqQlX2oZu4=; b=lDPBOACCVFbUtcADf2b/NIja63CaDRCwkZl4l21qstFEMrshzaSGYWsO83cWG94RjW xOjbvkmpLGnJXx1w9d/c6OpZ1Hj3sc/qRBUYDSWg/RTVulVU3iZhSP+LmjZpZbqIOXLo lftyPDVBpKkLrM0W9BNhXxPyLAUTxMcZYeeG4DvThSFZCbRVZc+i/HaT9Ot96apzZlaR w6ug5SsMtdsmqvl1EhLAfyRTQ20ZqZg7QZrj0utLwpH4K9yQAExbv9oDpDS7hBTjXr7Y E0egQcH7/dBwSBnETY4kPgoTwan2kAX+xRFcxlqkFNPEFydXMYGwen11zHSZPHUFT9/V Lf+Q== 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 59-v6si3693717plp.720.2018.04.10.18.16.11; Tue, 10 Apr 2018 18:16:47 -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 S1753112AbeDKBEX (ORCPT + 99 others); Tue, 10 Apr 2018 21:04:23 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:46969 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753093AbeDKBEV (ORCPT ); Tue, 10 Apr 2018 21:04:21 -0400 Received: by mail-pl0-f65.google.com with SMTP id 59-v6so115857plc.13 for ; Tue, 10 Apr 2018 18:04:21 -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=wKq7BowXlYKx0270E2z2yatGRuasNAfpSUqQlX2oZu4=; b=EeGN4hNzF5KL5F141Fixgw3RdvrTPmKFruqV0cOu9ioxeoCvc74PhaNSsvgZEtT0la 60iZdPMZCopKHVpQ9/0SemEbVc+lFPSKg58MkFfNkSqvAwKnGr+l5scfLEouiDfv+LGg fKqZjaO7orMaMShvkBqa3U1Efv9IizNnOR5lOAWNGE4FQz+1k2RMROBOnUNhxhYLoPwW M9nbiXDa4C/hGm8ieEdZoYDJbwGpDZXvMwgEWoXzL9NtTPPtbWOw2vncPbKZQhFgr4Gm 1+UEzM/5+PAYKv5jPr8+fMNrZpiggPfP1wv3fvOPfA8/nYdR0vDPPPwk/g663qnW6sXF Uqzg== X-Gm-Message-State: ALQs6tAWwZXTED12BFOPyHNfKXGDMw2MEWNcFEme4ZyzibFhrO1cVZ06 qHk6oPe6+szUqI0U4XUgVe6PyQ== X-Received: by 2002:a17:902:4d45:: with SMTP id o5-v6mr2807661plh.84.1523408661291; Tue, 10 Apr 2018 18:04:21 -0700 (PDT) Received: from labbott-redhat.redhat.com ([2601:602:9802:a8dc:4eb2:6dae:ab32:e5b0]) by smtp.gmail.com with ESMTPSA id z10sm6589868pgr.68.2018.04.10.18.04.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Apr 2018 18:04:20 -0700 (PDT) From: Laura Abbott To: Alex Dubov , Arnd Bergmann , Greg Kroah-Hartman Cc: Laura Abbott , linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Subject: [PATCHv2] misc: tifm: Remove VLA Date: Tue, 10 Apr 2018 18:04:12 -0700 Message-Id: <20180411010412.18006-1-labbott@redhat.com> X-Mailer: git-send-email 2.14.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There's an ongoing effort to remove VLAs[1] from the kernel to eventually turn on -Wvla. The single VLA can either take a value of 2 or 4 so switch to the upper bound. [1] https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Laura Abbott --- v2: Add extra bounds check per request of Arnd --- drivers/misc/tifm_7xx1.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c index e5f108713dd8..9ac95b48ef92 100644 --- a/drivers/misc/tifm_7xx1.c +++ b/drivers/misc/tifm_7xx1.c @@ -239,9 +239,13 @@ static int tifm_7xx1_resume(struct pci_dev *dev) unsigned long timeout; unsigned int good_sockets = 0, bad_sockets = 0; unsigned long flags; - unsigned char new_ids[fm->num_sockets]; + /* Maximum number of entries is 4 */ + unsigned char new_ids[4]; DECLARE_COMPLETION_ONSTACK(finish_resume); + if (WARN_ON(fm->num_sockets > ARRAY_SIZE(new_ids))) + return -ENXIO; + pci_set_power_state(dev, PCI_D0); pci_restore_state(dev); rc = pci_enable_device(dev); -- 2.14.3