diff options
author | Jan Blunck <jblunck@suse.de> | 2006-09-26 02:30:53 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-26 11:48:44 -0400 |
commit | 632bbfeee4f042c05bc65150b4433a297d3fe387 (patch) | |
tree | ce67b5fa4bec38610fc0ecb9b20be6aa69763bb3 /include/asm-x86_64 | |
parent | 0a2966b48fb784e437520e400ddc94874ddbd4e8 (diff) |
[PATCH] trigger a syntax error if percpu macros are incorrectly used
get_cpu_var()/per_cpu()/__get_cpu_var() arguments must be simple
identifiers. Otherwise the arch dependent implementations might break.
This patch enforces the correct usage of the macros by producing a syntax
error if the variable is not a simple identifier.
Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-x86_64')
-rw-r--r-- | include/asm-x86_64/percpu.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/include/asm-x86_64/percpu.h b/include/asm-x86_64/percpu.h index 08dd9f9dda81..bffb2f886a51 100644 --- a/include/asm-x86_64/percpu.h +++ b/include/asm-x86_64/percpu.h | |||
@@ -21,9 +21,15 @@ | |||
21 | __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name | 21 | __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name |
22 | 22 | ||
23 | /* var is in discarded region: offset to particular copy we want */ | 23 | /* var is in discarded region: offset to particular copy we want */ |
24 | #define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu))) | 24 | #define per_cpu(var, cpu) (*({ \ |
25 | #define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset())) | 25 | extern int simple_indentifier_##var(void); \ |
26 | #define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset())) | 26 | RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu)); })) |
27 | #define __get_cpu_var(var) (*({ \ | ||
28 | extern int simple_indentifier_##var(void); \ | ||
29 | RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()); })) | ||
30 | #define __raw_get_cpu_var(var) (*({ \ | ||
31 | extern int simple_indentifier_##var(void); \ | ||
32 | RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()); })) | ||
27 | 33 | ||
28 | /* A macro to avoid #include hell... */ | 34 | /* A macro to avoid #include hell... */ |
29 | #define percpu_modcopy(pcpudst, src, size) \ | 35 | #define percpu_modcopy(pcpudst, src, size) \ |