mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
Kbuild: make designated_init attribute fatal
[ Upstream commit c834f0e8a8 ]
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 <keescook@chromium.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
a67a32da60
commit
a250cab009
3
Makefile
3
Makefile
@@ -834,6 +834,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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user