[PATCH 0/2] Add __counted_by_ptr macro

From: Bill Wendling

Date: Fri Nov 21 2025 - 14:40:07 EST


These patches add the __counted_by_ptr macro and then uses it in
mm/memblock.h. The name of the __counted_by_ptr attribute is the same as
__counted_by, but two different macros are needed, because of feature
skew in GCC and clang. Once the minmum versions of the compilers support
'counted_by' on both flexible array members and pointers in structs,
this macro will become obsolete.

Bill Wendling (2):
Compiler Attributes: Add __counted_by_ptr macro
memblock: annotate struct memblock_type with __counted_by_ptr

include/linux/compiler_types.h | 11 +++++++++++
include/linux/memblock.h | 2 +-
init/Kconfig | 5 +++++
3 files changed, 17 insertions(+), 1 deletion(-)

--
2.52.0.rc2.455.g230fcf2819-goog