[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.1.10.0910141039290.26476@gentwo.org>
Date: Wed, 14 Oct 2009 10:41:58 -0400 (EDT)
From: Christoph Lameter <cl@...ux-foundation.org>
To: Tejun Heo <tj@...nel.org>
cc: linux-kernel@...r.kernel.org, rusty@...tcorp.com.au,
mingo@...hat.com, tglx@...utronix.de, akpm@...ux-foundation.org,
rostedt@...dmis.org, hpa@...or.com, cebbert@...hat.com,
Al Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH 16/16] percpu: make accessors check for percpu pointer
in sparse
On Wed, 14 Oct 2009, Tejun Heo wrote:
> #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)); \
> +})
If you have the verification in SHIFT_PER_CPU_PTR then why do you need it
elsewhere?
> #define __pcpu_size_call_return(stem, variable) \
> ({ typeof(variable) pscr_ret__; \
> + __verify_pcpu_ptr(&(variable)); \
> switch(sizeof(variable)) { \
> case 1: pscr_ret__ = stem##1(variable);break; \
> case 2: pscr_ret__ = stem##2(variable);break; \
> @@ -250,6 +251,7 @@ extern void __bad_size_call_parameter(void);
>
> #define __pcpu_size_call(stem, variable, ...) \
> do { \
> + __verify_pcpu_ptr(&(variable)); \
> switch(sizeof(variable)) { \
> case 1: stem##1(variable, __VA_ARGS__);break; \
> case 2: stem##2(variable, __VA_ARGS__);break; \
Would it not be better to put the verification in the arch code? The
percpu_to/from_op may have multiple callsites (at least they have now). If
you put it in there then all other stuff is covered.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists