overflow: Add STACK_FLEX_ARRAY_SIZE() helper
authorGustavo A. R. Silva <gustavoars@kernel.org>
Tue, 22 Apr 2025 21:05:18 +0000 (15:05 -0600)
committerKees Cook <kees@kernel.org>
Thu, 8 May 2025 16:42:05 +0000 (09:42 -0700)
commit190faecf64c54bb5f9d8f0ea2a6628078d0f2c83
tree335a946e7b7120a9689cebcb0f2fa8cad3cd3b88
parentccf1d2b4a1d9ef4287ff51e634c626fd4683b10c
overflow: Add STACK_FLEX_ARRAY_SIZE() helper

Add new STACK_FLEX_ARRAY_SIZE() helper to get the size of a
flexible-array member defined using DEFINE_FLEX()/DEFINE_RAW_FLEX()
at compile time.

This is essentially the same as ARRAY_SIZE() but for on-stack
flexible-array members.

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/83d53744e11c80eb3f03765238cbe648855f4168.1745355442.git.gustavoars@kernel.org
Signed-off-by: Kees Cook <kees@kernel.org>
include/linux/overflow.h