Received: by 10.223.185.116 with SMTP id b49csp102469wrg; Thu, 8 Mar 2018 13:39:59 -0800 (PST) X-Google-Smtp-Source: AG47ELt5YYt2J7mG0/IWeUTs2+f1D+tG2Ed3N0D9DTDy1kNkyBVjkhJTPYodN3E8ZEkiKJYYFgkh X-Received: by 2002:a17:902:424:: with SMTP id 33-v6mr25638554ple.433.1520545199384; Thu, 08 Mar 2018 13:39:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520545199; cv=none; d=google.com; s=arc-20160816; b=g/IxFZtovMWpMEAK2tvk291Bkq8hIIF7NkWNf/Fi/lPHEWArnZ0E2qInQc9XTmQypR +1RklFyuhevY/a/5FynDv6Wy3jsArVy7LTUfsQJ6wzdRfkVPg9KqEtra2GWv7eelUlHY /GU7wYjBKvEQHfV/km3vrIIzfjv8S01AdVExXqNP4CaNqCTAoVLAcpaLGVfYK0UnDys2 P9tpggn495CXIHx7ySykR5NOMqoyi/FOqXzVL5XD4yKFff1GPB/8QejD83bjl/44Sbcn drKMZoJMUrppvg5Seelwn234CHIMkQTrSY+scrdgacmX/yG+gG0OLbrkNuq95nc1JH1L eQEg== 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=vH0aSa/HU5qPk+FC+9WacFTVfALMadgR2Bifb0Z+M3c=; b=C1vXOnxDYwjB+AbJuXLHKGfv62ni/RSLh3EkafGcz79iP65IyIRLcMD4t2g/ZNYuLp WyC9AxWtfHAGrX8QmWr0CIYa2H5AL2QNvLp6Xh10dyPEuOHfbFEdRhkumsQXllXLwsA/ VctSYCQ2yY42vEUOlGoQquznjXJyO4qk7+Hczm+uip3fh42crrG5ykXqR/WwQGibXrF+ /hVmreZrLAZXWK20+2rkCIDFRoaMyVySF171cggr9Rb0VfJiMmf8CxjpkOdUDMS1GhFG kbPpaZT9UIz7QUa/caLNTuXii3LUP1qMgOin/dVY7kM5KB9yk+syWYJLsDsiMudzvZu7 I1Eg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n16si13542720pgf.397.2018.03.08.13.39.44; Thu, 08 Mar 2018 13:39:59 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750955AbeCHVis (ORCPT + 99 others); Thu, 8 Mar 2018 16:38:48 -0500 Received: from smtp5-g21.free.fr ([212.27.42.5]:48522 "EHLO smtp5-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750713AbeCHVir (ORCPT ); Thu, 8 Mar 2018 16:38:47 -0500 Received: from heffalump.sk2.org (unknown [88.186.243.14]) by smtp5-g21.free.fr (Postfix) with ESMTPS id E13FB5FFAF; Thu, 8 Mar 2018 22:38:45 +0100 (CET) Received: from steve by heffalump.sk2.org with local (Exim 4.89) (envelope-from ) id 1eu3FM-0003bN-RQ; Thu, 08 Mar 2018 22:38:45 +0100 From: Stephen Kitt To: hare@suse.com Cc: linux-scsi@vger.kernel.org, kernel-hardening@lists.openwall.com, linux-kernel@vger.kernel.org, Stephen Kitt Subject: [PATCH] bfa: remove VLA Date: Thu, 8 Mar 2018 22:38:41 +0100 Message-Id: <20180308213841.13807-1-steve@sk2.org> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In preparation to enabling -Wvla, remove VLAs and replace them with fixed-length arrays instead. bfad_bsg.c uses a variable-length array declaration to measure the size of a putative array; this can be replaced by the product of the size of an element and the number of elements, avoiding the VLA altogether. This was prompted by https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Stephen Kitt --- drivers/scsi/bfa/bfad_bsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c index 3976e787ba64..7c884f881180 100644 --- a/drivers/scsi/bfa/bfad_bsg.c +++ b/drivers/scsi/bfa/bfad_bsg.c @@ -891,7 +891,7 @@ bfad_iocmd_fabric_get_lports(struct bfad_s *bfad, void *cmd, if (bfad_chk_iocmd_sz(payload_len, sizeof(struct bfa_bsg_fabric_get_lports_s), - sizeof(wwn_t[iocmd->nports])) != BFA_STATUS_OK) { + sizeof(wwn_t) * iocmd->nports) != BFA_STATUS_OK) { iocmd->status = BFA_STATUS_VERSION_FAIL; goto out; } -- 2.11.0