Skip to content

Commit 7a618ca

Browse files
nathanchancekees
authored andcommitted
init/Kconfig: Require a release version of clang-22 for CC_HAS_COUNTED_BY_PTR
Commit 150a04d ("compiler_types.h: Attributes: Add __counted_by_ptr macro") used Clang 22.0.0 as a minimum supported version for __counted_by_ptr, which made sense while 22.0.0 was the version of LLVM's main branch to allow developers to easily test and develop uses of __counted_by_ptr in their code. However, __counted_by_ptr requires a change [1] merged towards the end of the 22 development cycle to avoid errors when applied to void pointers. In file included from fs/xfs/xfs_attr_inactive.c:18: fs/xfs/libxfs/xfs_attr.h:59:2: error: 'counted_by' cannot be applied to a pointer with pointee of unknown size because 'void' is an incomplete type 59 | void *buffer __counted_by_ptr(bufsize); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This is disruptive for deployed prerelease clang-22 builds (such as Android LLVM) or when bisecting between llvmorg-21-init and the fix. Require a released version of clang-22 (i.e., 21.1.0 or newer) to enabled __counted_by_ptr to ensure all fixes needed for proper support are present. Fixes: 150a04d ("compiler_types.h: Attributes: Add __counted_by_ptr macro") Link: llvm/llvm-project@f29955a [1] Signed-off-by: Nathan Chancellor <nathan@kernel.org> Link: https://patch.msgid.link/20260318-counted_by_ptr-release-clang-22-v1-1-e017da246df0@kernel.org Signed-off-by: Kees Cook <kees@kernel.org>
1 parent 1c7bbae commit 7a618ca

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

init/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ config CC_HAS_COUNTED_BY
146146
config CC_HAS_COUNTED_BY_PTR
147147
bool
148148
# supported since clang 22
149-
default y if CC_IS_CLANG && CLANG_VERSION >= 220000
149+
default y if CC_IS_CLANG && CLANG_VERSION >= 220100
150150
# supported since gcc 16.0.0
151151
default y if CC_IS_GCC && GCC_VERSION >= 160000
152152

0 commit comments

Comments
 (0)