Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXu5j+_DvU4jNESxO2zBvP_VrTxOwVzh_NXqdw+S5amQukNjg@mail.gmail.com>
Date: Thu, 8 Mar 2018 13:43:07 -0800
From: Kees Cook <keescook@...omium.org>
To: Stephen Kitt <steve@....org>
Cc: hare <hare@...e.com>, linux-scsi@...r.kernel.org, 
	Kernel Hardening <kernel-hardening@...ts.openwall.com>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] bfa: remove VLA

On Thu, Mar 8, 2018 at 1:38 PM, Stephen Kitt <steve@....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@....org>

Reviewed-by: Kees Cook <keescook@...omium.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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.