On Wed, 2 Aug 2006 15:30:06 +0200
Jan Blunck <[email protected]> wrote:
> Here comes another idea. To find further wrong usage of percpu variables I
> wrote the following patch. It still needs some work for the other archs but
> I'm interested in your feedback about that.
>
> ...
>
> Index: linux-2.6/include/asm-generic/percpu.h
> ===================================================================
> --- linux-2.6.orig/include/asm-generic/percpu.h
> +++ linux-2.6/include/asm-generic/percpu.h
> @@ -14,7 +14,9 @@ extern unsigned long __per_cpu_offset[NR
> __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name
>
> /* var is in discarded region: offset to particular copy we want */
> -#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
> +#define per_cpu(var, cpu) (*({ \
> + int user_error_##var __attribute__ ((unused)); \
> + RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]); }))
What's it do? Forces a syntax error if `var' isn't a simple identifier?
Seems sane, although I'd check that the compiler doesn't accidentally
waste a stack slot for that local. Perhaps it's be safer to make
it a non-existing function:
extern int user_error#var(void);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]