summaryrefslogtreecommitdiff
path: root/include/linux/timerqueue.h
diff options
context:
space:
mode:
authorYury Norov <ynorov@nvidia.com>2026-09-11 18:14:42 -0400
committerAndrew Morton <akpm@linux-foundation.org>2026-10-08 22:55:12 -0700
commit2233228b65291f8e9b04ee8be52bd2f694e12889 (patch)
treed2178bee08a85c31deacc4a0fe645e2b740b2cff /include/linux/timerqueue.h
parentc3f25ea70432ac917e1881b08e62732f3cf33f97 (diff)
downloadlinux-2233228b65291f8e9b04ee8be52bd2f694e12889.tar.gz
linux-2233228b65291f8e9b04ee8be52bd2f694e12889.zip
idr: assert static storage for DEFINE_IDA()
DEFINE_IDA() uses IDA_INIT(), which initializes the embedded XArray lock with a static spinlock initializer. For an automatic local IDA, lockdep cannot use the lock address as a persistent class key and reports "INFO: trying to register non-static key" before disabling itself. Apply ASSERT_STATIC_STORAGE() to DEFINE_IDA() so that this misuse is rejected at compile time. For example: void example(void) { DEFINE_IDA(ida); ida_destroy(&ida); } GCC reports: error: initializer element is not constant name##_storage_check = &(name) ^ note: in expansion of macro 'ASSERT_STATIC_STORAGE' ASSERT_STATIC_STORAGE(name) note: in expansion of macro 'DEFINE_IDA' DEFINE_IDA(ida); File-scope definitions and static DEFINE_IDA() within a function remain valid. Automatic local IDAs must instead be initialized with ida_init(). Direct uses of IDA_INIT() are not covered by this declaration check. Convert the five automatic local IDAs in the userspace radix-tree tests to ida_init() so they satisfy the new requirement. Validated file-scope and static local definitions with a kernel object build, and confirmed that an automatic local definition fails to compile. Link: https://lore.kernel.org/20260911221444.1523311-3-ynorov@nvidia.com Signed-off-by: Yury Norov <ynorov@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Cc: Alice Ryhl <aliceryhl@google.com> Cc: Andrew Ballance <andrewjballance@gmail.com> Cc: Christopher Li <sparse@chrisli.org> Cc: Liam R. Howlett <liam@infradead.org> Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Diffstat (limited to 'include/linux/timerqueue.h')
0 files changed, 0 insertions, 0 deletions