From: Stephen Kitt <steve@sk2.org>
To: Anil Gurumurthy <anil.gurumurthy@qlogic.com>,
Sudarsana Kalluru <sudarsana.kalluru@qlogic.com>
Cc: linux-scsi@vger.kernel.org,
Kernel Hardening <kernel-hardening@lists.openwall.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] bfa: remove VLA
Date: Fri, 9 Mar 2018 23:15:42 +0100 [thread overview]
Message-ID: <20180309231542.3eb53b87@heffalump.sk2.org> (raw)
In-Reply-To: <CAGXu5j+_DvU4jNESxO2zBvP_VrTxOwVzh_NXqdw+S5amQukNjg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1693 bytes --]
Hi,
I sent this to the wrong maintainers, sorry — you’ll find the original patch
on https://patchwork.kernel.org/patch/10269257/
Regards,
Stephen
On Thu, 8 Mar 2018 13:43:07 -0800, Kees Cook <keescook@chromium.org> wrote:
> On Thu, Mar 8, 2018 at 1:38 PM, Stephen Kitt <steve@sk2.org> 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 <steve@sk2.org>
>
> Reviewed-by: Kees Cook <keescook@chromium.org>
>
> -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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2018-03-09 22:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-08 21:38 [PATCH] bfa: remove VLA Stephen Kitt
2018-03-08 21:43 ` Kees Cook
2018-03-09 22:15 ` Stephen Kitt [this message]
2018-03-15 4:37 ` Martin K. Petersen
2018-03-15 11:40 ` David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180309231542.3eb53b87@heffalump.sk2.org \
--to=steve@sk2.org \
--cc=anil.gurumurthy@qlogic.com \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=sudarsana.kalluru@qlogic.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox