Subject: Re: [linux-next-20250422] Build failure: Wvla-larger-than=0 is meaningless

From: Kees Cook <[email-masked]>
Date: Fri, 25 Apr 2025 22:50:40 -0700

On Wed, Apr 23, 2025 at 07:11:43PM +0530, Venkat Rao Bagalkote wrote:
> I am observing linux-next build failure on IBM Power8 server.
> 
> 
> Repo: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> 
> Branch: master
> 
> GCC: 8.5.0 20210514
> 
> ldd (GNU libc) 2.28
> 
> Attached is the .config file.
> 
> 
> Build errors:
> 
> 
> [[01m^[[Kcc1:^[[m^[[K ^[[01;36m^[[Knote: ^[[m^[[K-Wvla-larger-than=0 is
> meaningless

Weird that it doesn't get dropped by "cc-option". I reproduced the
issue, and this patch seems to fix it:

diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 70ff932fd5ec..59d3d196fe4f 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -51,7 +51,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, dangling-pointer)
 # types, so depend on GCC for now to keep stack VLAs out of the tree.
 # https://github.com/llvm/llvm-project/issues/57098
 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98217
-KBUILD_CFLAGS += $(call cc-option,-Wvla-larger-than=0)
+KBUILD_CFLAGS += $(call cc-option,-Wvla-larger-than=1)
 
 # disable pointer signed / unsigned warnings in gcc 4.0
 KBUILD_CFLAGS += -Wno-pointer-sign

-- 
Kees Cook