[PATCH] kbuild: add -Wvla flag unconditionally

0 views
Skip to first unread message

Masahiro Yamada

unread,
May 9, 2019, 2:46:43 AM5/9/19
to linux-...@vger.kernel.org, Nick Desaulniers, Nathan Chancellor, Arnd Bergmann, clang-bu...@googlegroups.com, Masahiro Yamada, Michal Marek, linux-...@vger.kernel.org
This flag is documented in the GCC 4.6 manual, and recognized by
Clang as well. Let's rip off the cc-option switch.

Signed-off-by: Masahiro Yamada <yamada....@socionext.com>
---

Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index c71ffb6f55b5..3f5e8a0f4561 100644
--- a/Makefile
+++ b/Makefile
@@ -841,7 +841,7 @@ NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
KBUILD_CFLAGS += -Wdeclaration-after-statement

# Variable Length Arrays (VLAs) should not be used anywhere in the kernel
-KBUILD_CFLAGS += $(call cc-option,-Wvla)
+KBUILD_CFLAGS += -Wvla

# disable pointer signed / unsigned warnings in gcc 4.0
KBUILD_CFLAGS += -Wno-pointer-sign
--
2.17.1

Sedat Dilek

unread,
May 9, 2019, 3:08:12 AM5/9/19
to Masahiro Yamada, linux-...@vger.kernel.org, Nick Desaulniers, Nathan Chancellor, Arnd Bergmann, Clang-Built-Linux ML, Michal Marek, linux-...@vger.kernel.org, Kees Cook
On Thu, May 9, 2019 at 8:46 AM Masahiro Yamada
<yamada....@socionext.com> wrote:
>
> This flag is documented in the GCC 4.6 manual, and recognized by
> Clang as well. Let's rip off the cc-option switch.
>

[ CC Kees who did the VLA removal/cleanup ]

Looks good to me.

Reviewed-by: Sedat Dilek <sedat...@gmail.com>

> Signed-off-by: Masahiro Yamada <yamada....@socionext.com>
> ---
>
> Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index c71ffb6f55b5..3f5e8a0f4561 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -841,7 +841,7 @@ NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
> KBUILD_CFLAGS += -Wdeclaration-after-statement
>
> # Variable Length Arrays (VLAs) should not be used anywhere in the kernel
> -KBUILD_CFLAGS += $(call cc-option,-Wvla)
> +KBUILD_CFLAGS += -Wvla
>
> # disable pointer signed / unsigned warnings in gcc 4.0
> KBUILD_CFLAGS += -Wno-pointer-sign
> --
> 2.17.1
>
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-li...@googlegroups.com.
> To post to this group, send email to clang-bu...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20190509064549.1302-1-yamada.masahiro%40socionext.com.
> For more options, visit https://groups.google.com/d/optout.

Nathan Chancellor

unread,
May 9, 2019, 7:16:07 AM5/9/19
to Masahiro Yamada, linux-...@vger.kernel.org, Nick Desaulniers, Arnd Bergmann, clang-bu...@googlegroups.com, Michal Marek, linux-...@vger.kernel.org
On Thu, May 09, 2019 at 03:45:49PM +0900, Masahiro Yamada wrote:
> This flag is documented in the GCC 4.6 manual, and recognized by
> Clang as well. Let's rip off the cc-option switch.
>
> Signed-off-by: Masahiro Yamada <yamada....@socionext.com>

Reviewed-by: Nathan Chancellor <natecha...@gmail.com>

Kees Cook

unread,
May 9, 2019, 12:11:40 PM5/9/19
to Masahiro Yamada, linux-kbuild, Nick Desaulniers, Nathan Chancellor, Arnd Bergmann, clang-bu...@googlegroups.com, Michal Marek, LKML
On Wed, May 8, 2019 at 11:46 PM Masahiro Yamada
<yamada....@socionext.com> wrote:
> This flag is documented in the GCC 4.6 manual, and recognized by
> Clang as well. Let's rip off the cc-option switch.
>
> Signed-off-by: Masahiro Yamada <yamada....@socionext.com>

Acked-by: Kees Cook <kees...@chromium.org>

--
Kees Cook

Nick Desaulniers

unread,
May 9, 2019, 12:52:10 PM5/9/19
to Kees Cook, Masahiro Yamada, linux-kbuild, Nathan Chancellor, Arnd Bergmann, clang-built-linux, Michal Marek, LKML
> On Wed, May 8, 2019 at 11:46 PM Masahiro Yamada
> <yamada....@socionext.com> wrote:
> > This flag is documented in the GCC 4.6 manual, and recognized by
> > Clang as well. Let's rip off the cc-option switch.

Checked w/ godbolt w/ Clang 4 and GCC 4.6.4.
Tested-by: Nick Desaulniers <ndesau...@google.com>

--
Thanks,
~Nick Desaulniers

Masahiro Yamada

unread,
May 12, 2019, 10:24:25 PM5/12/19
to Nick Desaulniers, Kees Cook, linux-kbuild, Nathan Chancellor, Arnd Bergmann, clang-built-linux, Michal Marek, LKML
Applied to linux-kbuild.


--
Best Regards
Masahiro Yamada
Reply all
Reply to author
Forward
0 new messages