From: Christoph Lameter Date: Fri, 23 Aug 2013 19:01:58 +0000 (+0000) Subject: percpu: Make __verify_pcu_ptr handle per cpu pointers to arrays X-Git-Tag: firefly_0821_release~176^2~5464^2 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=abec1a806e0c3cf168999667d5fb6218398ef12a;p=firefly-linux-kernel-4.4.55.git percpu: Make __verify_pcu_ptr handle per cpu pointers to arrays __verify_pcpu_ptr() will cause a compilation failure if the type of the pointer is a pointer to a fixed array of objects. Adding zero to the pointer converts the type of pointer to that pointing to a single object of the array. Signed-off-by: Christoph Lameter Signed-off-by: Tejun Heo --- diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h index 27ef6b190ea6..57e890abe1f0 100644 --- a/include/linux/percpu-defs.h +++ b/include/linux/percpu-defs.h @@ -22,9 +22,12 @@ * Macro which verifies @ptr is a percpu pointer without evaluating * @ptr. This is to be used in percpu accessors to verify that the * input parameter is a percpu pointer. + * + * + 0 is required in order to convert the pointer type from a + * potential array type to a pointer to a single item of the array. */ #define __verify_pcpu_ptr(ptr) do { \ - const void __percpu *__vpp_verify = (typeof(ptr))NULL; \ + const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \ (void)__vpp_verify; \ } while (0)