Received: by 10.223.185.116 with SMTP id b49csp105727wrg; Thu, 8 Mar 2018 13:44:16 -0800 (PST) X-Google-Smtp-Source: AG47ELuQ89Qso5wfpIX3vhZYS2Pd6rbAZnblt6EhWeatEGLmkOaZZrxyLtAU2hZa9kORvW5EtFP2 X-Received: by 2002:a17:902:41:: with SMTP id 59-v6mr25092662pla.48.1520545456807; Thu, 08 Mar 2018 13:44:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520545456; cv=none; d=google.com; s=arc-20160816; b=aA2EamIfpAyC2MHQbLsCUSik/WxtBlnDLxlRFztYL5DNSwVDmp+mw7dotxsaGW1hLX wbIoq9Lqvk006PVOHMh853wGBtXb4Vo8BnDpE2vC+CiDJYlESmRNh+TYhpz49bof7yn9 cpYbcLCaSS/Y8wWmCg0ggTZaFgjEa6EHRaMRm+RauCp06fgfjVWV1eBaAKsrZjMmBVpi d1wZRh11mtKuF7br8wRY+pTRix2SAThoTqQQXOn6be+ziehvIC4D6VUsGxi2xntXnth4 j8U1Ln3SvRDCVJWg6W9rLaS2FAg7HMmpSbbUUNI3tx39SeZEOiYA8qB66Lp+5lB9P/yO Wa6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=FsgCRzrIT2zTu3rBsE1PDyKJ4oK45bQI+ULBde645QE=; b=UyjNJrz+fe7HK33jaHhsP2mjASf6EKE6IbhW7ssDZPTsDzSmEFV0xSP4tPfVENYKIv hgDgbqm8y96dvKVer7Ih8Zrg2SUU/fR35OIQQTDLn5gRVo30V8+CelVy/W9T/0FwPBxJ MC9fNF4n/nOcP8DTZOy8UeweEKUiAPdVNzVKvM7gPzRgG2Oek2QG1rgCZIKaNZzCGJsL R7ZNPy+Kck+I4oDXtM0ylEGPb5e+zrh++rwC/oDnBLl3fs3vBV632Mpg9jzNyDHHjTb3 6/1zt8FWl83FzsworUiq3HV0u4CeGYkSldl0fw/bj2IJwdEdHkZu3fi9S328Hme7NfuH L1CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@google.com header.s=20161025 header.b=VSdPPLNy; dkim=fail header.i=@chromium.org header.s=google header.b=g4xQG4iV; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v1-v6si1884714ply.475.2018.03.08.13.44.02; Thu, 08 Mar 2018 13:44:16 -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; dkim=fail header.i=@google.com header.s=20161025 header.b=VSdPPLNy; dkim=fail header.i=@chromium.org header.s=google header.b=g4xQG4iV; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751144AbeCHVnK (ORCPT + 99 others); Thu, 8 Mar 2018 16:43:10 -0500 Received: from mail-ua0-f195.google.com ([209.85.217.195]:44564 "EHLO mail-ua0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750836AbeCHVnI (ORCPT ); Thu, 8 Mar 2018 16:43:08 -0500 Received: by mail-ua0-f195.google.com with SMTP id s92so893341uas.11 for ; Thu, 08 Mar 2018 13:43:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=FsgCRzrIT2zTu3rBsE1PDyKJ4oK45bQI+ULBde645QE=; b=VSdPPLNy5vCbm0xdxnir57tCxRp550bqs2PoYPFuI1dcldL64h7Ndg8kuOXRy9Es+t vmU/dUXYHZcxCyIAmwA6cHOCoDK8RQbDY7DfSBKXaH4s57Hyyf80cvMo/2RtbWYUyn8i 6rb3vwv/dBgOCylV2hEZsLnp5nIVLys5cIaRGTsvTXBdgBnLoGQ2Q35YxVCHgbzu+31S EHMWJr4HfYM5ENmRflBeu/PF6X8WiYedpzIWxLOSWeCNrVAVwuMmYv45y9a+ieWY22Pp ncy9mBatVA842WcP0IDwOhaFdU27M7Ew6x97efrVR8OZlDOqbJC0meRWgejUSkYasZnj t6oA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=FsgCRzrIT2zTu3rBsE1PDyKJ4oK45bQI+ULBde645QE=; b=g4xQG4iV06jQk2MgGFFX2PbX9Wb3Paj/aViCQYBTUvbyX12xc5YBYTg2+On3dleAog CAIzPOYSjKUHJ/Kbsw7OPgtaryb2FH6c/R9ZJoWQnXLUILXPDCF2321xfEZv2UNN+zVn eKyS8V30YGVwVWTSkK9F4Ic2ZrMnTiUeL3Nc0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=FsgCRzrIT2zTu3rBsE1PDyKJ4oK45bQI+ULBde645QE=; b=BI+OI+zLIwoXdNGbkF6Iw39CSewaBC+KIw3j7xXS7NtbhkEMy+xwxfVDxzEpVsXJKT JCPX5iMAUqXubNMAvfFu9BPFOH5Qnjf1jeA5x53wsMTruhQLXnv+DkV0gNviUA+/vGKI pT2HSRPHKZ+H/5TjLaHPh/hL2P1vbpRejZ/8Liuz2M+/mwnNn3a+G45e1wpQaEhNYMt6 vk073KZN9354jD+EvSj3uY1rrcRR3Y7j35V7Uh92MzpQu+nFxLJWRP9Xuok0l7VQKgCi lO7gr4/gqPD71IJwznXnT1L1PmVp5YDMXZf8ShpCr2rWlTbDw/kL04eoHExM906D7Ogw 5DQg== X-Gm-Message-State: APf1xPC3GLVWrDRppN554tfFP1TMGdJwQZfd+rfXYkWzqy0MytHSx3Rk 6U3p6Tnl9NaDN05ErKqTXac4FHSkeFGbk553LpHEmg== X-Received: by 10.159.36.243 with SMTP id 106mr19989926uar.83.1520545387660; Thu, 08 Mar 2018 13:43:07 -0800 (PST) MIME-Version: 1.0 Received: by 10.31.242.140 with HTTP; Thu, 8 Mar 2018 13:43:07 -0800 (PST) In-Reply-To: <20180308213841.13807-1-steve@sk2.org> References: <20180308213841.13807-1-steve@sk2.org> From: Kees Cook Date: Thu, 8 Mar 2018 13:43:07 -0800 X-Google-Sender-Auth: gaD_F1DaqU4mzYsnTZZfLhCshzw Message-ID: Subject: Re: [PATCH] bfa: remove VLA To: Stephen Kitt Cc: hare , linux-scsi@vger.kernel.org, Kernel Hardening , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 8, 2018 at 1:38 PM, Stephen Kitt wrote: > 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 Reviewed-by: Kees Cook -Kees > --- > 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 > -- Kees Cook Pixel Security