Re: [PATCH] m68k/atari: Avoid VLA use in atari_switches_setup()

From: Arnd Bergmann
Date: Tue Jan 08 2019 - 08:25:41 EST


On Mon, Jan 7, 2019 at 10:29 AM Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> wrote:
>
> With gcc 7.3.0:
>
> arch/m68k/atari/config.c: In function âatari_switches_setupâ:
> arch/m68k/atari/config.c:151:2: warning: ISO C90 forbids variable length array âswitchesâ [-Wvla]
> char switches[strlen(str) + 1];
> ^~~~
>
> Replace the variable size by the maximum kernel command line size (512
> bytes), which is an upper limit for all suboptions.
>
> Signed-off-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>

Seems fine as long as COMMAND_LINE_SIZE never grows a lot. Some
architectures use 1024 or 2048, but m68k currently has 256 (you write
512 here).

Arnd