diff options
| author | Ricardo Ribalda <ribalda@chromium.org> | 2026-09-14 13:53:31 +0000 |
|---|---|---|
| committer | Paul E. McKenney <paulmck@kernel.org> | 2026-10-06 11:56:16 -0700 |
| commit | 0381ade2ea82b48584fa57ef23d63f97b2d87d7b (patch) | |
| tree | 96a5dd411ef8a80cc4b9ffaec9e7d9b458e95f86 /kernel | |
| parent | 5de907d24919f42ec2e221ed33a50749016368fe (diff) | |
| download | linux-next-0381ade2ea82b48584fa57ef23d63f97b2d87d7b.tar.gz linux-next-0381ade2ea82b48584fa57ef23d63f97b2d87d7b.zip | |
rcu: Drop the address space qualifier from the dereference macros
The RCU dereference macros end with a cast that is meant to hand back a
plain kernel pointer from a __rcu pointer.
For that it uses:
((typeof(*p) __force __kernel *)(local))
The problem is that typeof preserves every qualifier, including the
address space qualifiers (__rcu).
Recent versions of smatch[1] care about this and throw tens of warnings
like this one:
./include/trace/events/vb2.h:46:1: warning: incorrect type in assignment (different address spaces)
./include/trace/events/vb2.h:46:1: expected struct tracepoint_func *it_func_ptr
./include/trace/events/vb2.h:46:1: got struct tracepoint_func __rcu *
Use a new macro TYPEOF_NO_ADDRESS_SPACE() for the result type. This new
macro strips all the qualifiers when running with sparse (so const and
volatile are gone). But keeps all the qualifiers when running with the
compiler, caring about const/volatile mismatch.
[1] https://github.com/error27/smatch/commit/e53027a4e816a772403baafa83c09e4a94c1cb8f
Suggested-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/20260825-unqual-v1-1-7024fb81b4f9@chromium.org
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Joel Fernandes <joelagnelf@nvidia.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'kernel')
0 files changed, 0 insertions, 0 deletions
