Re: [PATCH v2] net: dsa: Remove VLA usage

From: Andrew Lunn
Date: Wed Jul 18 2018 - 16:37:32 EST


On Thu, Jul 19, 2018 at 05:33:33AM +0900, David Miller wrote:
> From: Kees Cook <keescook@xxxxxxxxxxxx>
> Date: Mon, 16 Jul 2018 21:10:34 -0700
>
> > From: Salvatore Mesoraca <s.mesoraca16@xxxxxxxxx>
> >
> > We avoid 2 VLAs by using a pre-allocated field in dsa_switch. We also
> > try to avoid dynamic allocation whenever possible (when using fewer than
> > bits-per-long ports, which is the common case).
> >
> > Link: http://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qPXydAacU1RqZWA@xxxxxxxxxxxxxx
> > Link: http://lkml.kernel.org/r/20180505185145.GB32630@xxxxxxx
> > Signed-off-by: Salvatore Mesoraca <s.mesoraca16@xxxxxxxxx>
> > [kees: tweak commit subject and message slightly]
> > Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
>
> Florian and Andrew, please review.

Last time there was some discussion of just always allocating it to
make the code simpler. But the extra complexity is O.K.

Reviewed-by: Andrew Lunn <andrew@xxxxxxx>

Andrew