From: Kees Cook Date: Tue, 21 Mar 2017 00:14:11 +0000 (-0700) Subject: Kbuild: make designated_init attribute fatal X-Git-Tag: v4.12-rc1~27^2~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c834f0e8a8bb3025aac38e802fca2e686720f544;p=platform%2Fkernel%2Flinux-exynos.git Kbuild: make designated_init attribute fatal If a structure is marked with __attribute__((designated_init)) from GCC or Sparse, it needs to have all static initializers using designated initialization. Fail the build for any missing cases. This attribute will be used by the randstruct plugin to make sure randomized structures are being correctly initialized. Signed-off-by: Kees Cook Signed-off-by: Masahiro Yamada --- diff --git a/Makefile b/Makefile index 515aeea7e702..ae49fef98ca3 100644 --- a/Makefile +++ b/Makefile @@ -795,6 +795,9 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=date-time) # enforce correct pointer usage KBUILD_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types) +# Require designated initializers for all marked structures +KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init) + # use the deterministic mode of AR if available KBUILD_ARFLAGS := $(call ar-option,D)