]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
xen: Disallow variable length arrays
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 17 Sep 2018 14:49:14 +0000 (15:49 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 25 Sep 2018 10:59:32 +0000 (11:59 +0100)
Variable length arrays result in excess stack utilisation, with a risk
of stack overflow if the length is too large.  It also results in fairly
poor asm generation, because of requiring a divide as part of the space
calcuation.

Xen no longer has any variable length arrays, so take the opportunity to
formally disallow them.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Julien Grall <julien.grall@arm.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/Rules.mk

index ac0a8ea2e9046678e92d1d1aff71edcc817c96ec..9c697dc57b8c8257781f71d13be2d3d2bb6d7a18 100644 (file)
@@ -55,6 +55,7 @@ endif
 
 CFLAGS += -nostdinc -fno-builtin -fno-common
 CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith
+$(call cc-option-add,CFLAGS,CC,-Wvla)
 CFLAGS += -pipe -D__XEN__ -include $(BASEDIR)/include/xen/config.h
 CFLAGS-$(CONFIG_DEBUG_INFO) += -g
 CFLAGS += '-D__OBJECT_FILE__="$@"'