From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932831AbcFCK6r (ORCPT ); Fri, 3 Jun 2016 06:58:47 -0400 Received: from terminus.zytor.com ([198.137.202.10]:56738 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932517AbcFCK6p (ORCPT ); Fri, 3 Jun 2016 06:58:45 -0400 Date: Fri, 3 Jun 2016 03:58:09 -0700 From: tip-bot for Peter Zijlstra Message-ID: Cc: paulmck@linux.vnet.ibm.com, akpm@linux-foundation.org, torvalds@linux-foundation.org, adobriyan@gmail.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, mingo@kernel.org, hpa@zytor.com, peterz@infradead.org Reply-To: paulmck@linux.vnet.ibm.com, akpm@linux-foundation.org, torvalds@linux-foundation.org, adobriyan@gmail.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@kernel.org, peterz@infradead.org, hpa@zytor.com In-Reply-To: <20160522104827.GP3193@twins.programming.kicks-ass.net> References: <20160522104827.GP3193@twins.programming.kicks-ass.net> To: linux-tip-commits@vger.kernel.org Subject: [tip:locking/core] locking/barriers: Validate lockless_dereference() is used on a pointer type Git-Commit-ID: 25841ee0e9d2a1d952828138416701f20ea831eb X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 25841ee0e9d2a1d952828138416701f20ea831eb Gitweb: http://git.kernel.org/tip/25841ee0e9d2a1d952828138416701f20ea831eb Author: Peter Zijlstra AuthorDate: Sun, 22 May 2016 12:48:27 +0200 Committer: Ingo Molnar CommitDate: Fri, 3 Jun 2016 12:06:11 +0200 locking/barriers: Validate lockless_dereference() is used on a pointer type Add a cast to void * to validate the argument @p is indeed a pointer. Signed-off-by: Peter Zijlstra (Intel) Cc: Alexey Dobriyan Cc: Andrew Morton Cc: Linus Torvalds Cc: Paul E. McKenney Cc: Paul McKenney Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/20160522104827.GP3193@twins.programming.kicks-ass.net Signed-off-by: Ingo Molnar --- include/linux/compiler.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 793c082..e9c6417 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -545,9 +545,13 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s * Similar to rcu_dereference(), but for situations where the pointed-to * object's lifetime is managed by something other than RCU. That * "something other" might be reference counting or simple immortality. + * + * The seemingly unused void * variable is to validate @p is indeed a pointer + * type. All pointer types silently cast to void *. */ #define lockless_dereference(p) \ ({ \ + __maybe_unused const void * const _________p2 = p; \ typeof(p) _________p1 = READ_ONCE(p); \ smp_read_barrier_depends(); /* Dependency order vs. p above. */ \ (_________p1); \