aboutsummaryrefslogtreecommitdiff
path: root/include/asm-generic/percpu.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-10-29 22:34:15 +0900
committerTejun Heo <tj@kernel.org>2009-10-29 22:34:15 +0900
commit545695fb41da117928ab946067a42d9e15fd009d (patch)
tree1ea32c45a6f6efb03a88f99278f065054a5de3e2 /include/asm-generic/percpu.h
parente0fdb0e050eae331046385643618f12452aa7e73 (diff)
percpu: make accessors check for percpu pointer in sparse
The previous patch made sparse warn about percpu variables being used directly without going through percpu accessors. This patch implements the other half - checking whether non percpu variable is passed into percpu accessors. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/asm-generic/percpu.h')
-rw-r--r--include/asm-generic/percpu.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
index fded453fd25..04f91c2d3f7 100644
--- a/include/asm-generic/percpu.h
+++ b/include/asm-generic/percpu.h
@@ -42,8 +42,10 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
*/
#ifndef SHIFT_PERCPU_PTR
/* Weird cast keeps both GCC and sparse happy. */
-#define SHIFT_PERCPU_PTR(__p, __offset) \
- RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset))
+#define SHIFT_PERCPU_PTR(__p, __offset) ({ \
+ __verify_pcpu_ptr((__p)); \
+ RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset)); \
+})
#endif
/*