From nobody Wed Feb 11 19:28:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A8B7C7EE21 for ; Thu, 4 May 2023 21:02:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230302AbjEDVCV (ORCPT ); Thu, 4 May 2023 17:02:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230497AbjEDVBn (ORCPT ); Thu, 4 May 2023 17:01:43 -0400 Received: from smtpout.efficios.com (unknown [IPv6:2607:5300:203:b2ee::31e5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D9B01493C for ; Thu, 4 May 2023 14:01:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1683230732; bh=QRmMLfXg5unF7/3RNcMH7AOL6J3UpJBYx5LfEyiS2RI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v/dCD84HuYJgTT5w4IJtqAmtHBQh8auLZmyc/r854jojAY8mbnR7qunxRrDb9sm/H PuqMc5qLmGpf0CBbmricpzPkYNSERIKKeFL40PZmw64U1phoW3/ggTIZ+E2g4/aELv S30ofIhjNFqOU9X3sLYYavOSH8ljbEGVN6KfSnv1D84bVErgj3V6K5loX4+xKwYOCi zK1XyIig4dExnSpgyxNEGupyY9pxRo0k01WaggUNcSMG5FLPxOdAc4My9Us0IPxImJ BLRNcl9nQknH66s5Eq5XrY9xjP5nxHlm6MJlITftb3DdwY9G1s3ivy8Uy6rP3SyPYm GGfK4Q/1eDeRQ== Received: from localhost.localdomain (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4QC4Yl5vByzxRG; Thu, 4 May 2023 16:05:31 -0400 (EDT) From: Mathieu Desnoyers To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , "Paul E. McKenney" , Joel Fernandes , Josh Triplett , Boqun Feng , Steven Rostedt , Lai Jiangshan , Zqiang Subject: [RFC PATCH 01/13] rcu: rcupdate.h: Fix parentheses around macro parameter use Date: Thu, 4 May 2023 16:05:15 -0400 Message-Id: <20230504200527.1935944-2-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> References: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" linux/rcupdate.h macros use the *p parameter without parentheses, e.g.: typeof(*p) rather than typeof(*(p)) The following test-case shows how it can generate confusion due to C operator precedence being reversed compared to the expectations: #define m(p) \ do { \ __typeof__(*p) v =3D 0; \ } while (0) void fct(unsigned long long *p1) { m(p1 + 1); /* works */ m(1 + p1); /* broken */ } Add missing parentheses around macro parameter use in the following pattern to ensure operator precedence behaves as expected: - m(&p) is changed for m(&(p)). Remove useless parentheses in the following macro argument usage patterns: - m((x), y) is changed for m(x, y), because comma has the lowest operator precedence, and thus the extra parentheses are useless. - "(_r_a_p__v) where _r_a_p__v is a variable and not a macro parameter, is changed for "_r_a_p__v", An extra whitespace is also removed in kvfree_rcu_arg_2() for consistency. Signed-off-by: Mathieu Desnoyers Cc: "Paul E. McKenney" Cc: Joel Fernandes Cc: Josh Triplett Cc: Boqun Feng Cc: Steven Rostedt Cc: Lai Jiangshan Cc: Zqiang --- include/linux/rcupdate.h | 46 ++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index dcd2cf1e8326..4f26c3080953 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h @@ -215,7 +215,7 @@ void rcu_tasks_trace_qs_blkd(struct task_struct *t); \ if (likely(!READ_ONCE((t)->trc_reader_special.b.need_qs)) && \ likely(!___rttq_nesting)) { \ - rcu_trc_cmpxchg_need_qs((t), 0, TRC_NEED_QS_CHECKED); \ + rcu_trc_cmpxchg_need_qs(t, 0, TRC_NEED_QS_CHECKED); \ } else if (___rttq_nesting && ___rttq_nesting !=3D INT_MIN && \ !READ_ONCE((t)->trc_reader_special.b.blocked)) { \ rcu_tasks_trace_qs_blkd(t); \ @@ -227,7 +227,7 @@ void rcu_tasks_trace_qs_blkd(struct task_struct *t); =20 #define rcu_tasks_qs(t, preempt) \ do { \ - rcu_tasks_classic_qs((t), (preempt)); \ + rcu_tasks_classic_qs(t, preempt); \ rcu_tasks_trace_qs(t); \ } while (0) =20 @@ -430,16 +430,16 @@ static inline void rcu_preempt_sleep_check(void) { } =20 #ifdef __CHECKER__ #define rcu_check_sparse(p, space) \ - ((void)(((typeof(*p) space *)p) =3D=3D p)) + ((void)(((typeof(*(p)) space *)(p)) =3D=3D (p))) #else /* #ifdef __CHECKER__ */ #define rcu_check_sparse(p, space) #endif /* #else #ifdef __CHECKER__ */ =20 #define __unrcu_pointer(p, local) \ ({ \ - typeof(*p) *local =3D (typeof(*p) *__force)(p); \ + typeof(*(p)) *local =3D (typeof(*(p)) *__force)(p); \ rcu_check_sparse(p, __rcu); \ - ((typeof(*p) __force __kernel *)(local)); \ + ((typeof(*(p)) __force __kernel *)(local)); \ }) /** * unrcu_pointer - mark a pointer as not being RCU protected @@ -452,29 +452,29 @@ static inline void rcu_preempt_sleep_check(void) { } =20 #define __rcu_access_pointer(p, local, space) \ ({ \ - typeof(*p) *local =3D (typeof(*p) *__force)READ_ONCE(p); \ + typeof(*(p)) *local =3D (typeof(*(p)) *__force)READ_ONCE(p); \ rcu_check_sparse(p, space); \ - ((typeof(*p) __force __kernel *)(local)); \ + ((typeof(*(p)) __force __kernel *)(local)); \ }) #define __rcu_dereference_check(p, local, c, space) \ ({ \ /* Dependency order vs. p above. */ \ - typeof(*p) *local =3D (typeof(*p) *__force)READ_ONCE(p); \ + typeof(*(p)) *local =3D (typeof(*(p)) *__force)READ_ONCE(p); \ RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_check() usage"); \ rcu_check_sparse(p, space); \ - ((typeof(*p) __force __kernel *)(local)); \ + ((typeof(*(p)) __force __kernel *)(local)); \ }) #define __rcu_dereference_protected(p, local, c, space) \ ({ \ RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \ rcu_check_sparse(p, space); \ - ((typeof(*p) __force __kernel *)(p)); \ + ((typeof(*(p)) __force __kernel *)(p)); \ }) #define __rcu_dereference_raw(p, local) \ ({ \ /* Dependency order vs. p above. */ \ typeof(p) local =3D READ_ONCE(p); \ - ((typeof(*p) __force __kernel *)(local)); \ + ((typeof(*(p)) __force __kernel *)(local)); \ }) #define rcu_dereference_raw(p) __rcu_dereference_raw(p, __UNIQUE_ID(rcu)) =20 @@ -520,10 +520,10 @@ do { \ uintptr_t _r_a_p__v =3D (uintptr_t)(v); \ rcu_check_sparse(p, __rcu); \ \ - if (__builtin_constant_p(v) && (_r_a_p__v) =3D=3D (uintptr_t)NULL) \ - WRITE_ONCE((p), (typeof(p))(_r_a_p__v)); \ + if (__builtin_constant_p(v) && _r_a_p__v =3D=3D (uintptr_t)NULL) \ + WRITE_ONCE(p, (typeof(p))_r_a_p__v); \ else \ - smp_store_release(&p, RCU_INITIALIZER((typeof(p))_r_a_p__v)); \ + smp_store_release(&(p), RCU_INITIALIZER((typeof(p))_r_a_p__v));\ } while (0) =20 /** @@ -539,8 +539,8 @@ do { \ */ #define rcu_replace_pointer(rcu_ptr, ptr, c) \ ({ \ - typeof(ptr) __tmp =3D rcu_dereference_protected((rcu_ptr), (c)); \ - rcu_assign_pointer((rcu_ptr), (ptr)); \ + typeof(ptr) __tmp =3D rcu_dereference_protected(rcu_ptr, c); \ + rcu_assign_pointer(rcu_ptr, ptr); \ __tmp; \ }) =20 @@ -571,7 +571,7 @@ do { \ * down multi-linked structures after a grace period has elapsed. However, * rcu_dereference_protected() is normally preferred for this use case. */ -#define rcu_access_pointer(p) __rcu_access_pointer((p), __UNIQUE_ID(rcu), = __rcu) +#define rcu_access_pointer(p) __rcu_access_pointer(p, __UNIQUE_ID(rcu), __= rcu) =20 /** * rcu_dereference_check() - rcu_dereference with debug checking @@ -607,7 +607,7 @@ do { \ * annotated as __rcu. */ #define rcu_dereference_check(p, c) \ - __rcu_dereference_check((p), __UNIQUE_ID(rcu), \ + __rcu_dereference_check(p, __UNIQUE_ID(rcu), \ (c) || rcu_read_lock_held(), __rcu) =20 /** @@ -623,7 +623,7 @@ do { \ * rcu_read_lock() but also rcu_read_lock_bh() into account. */ #define rcu_dereference_bh_check(p, c) \ - __rcu_dereference_check((p), __UNIQUE_ID(rcu), \ + __rcu_dereference_check(p, __UNIQUE_ID(rcu), \ (c) || rcu_read_lock_bh_held(), __rcu) =20 /** @@ -639,7 +639,7 @@ do { \ * only rcu_read_lock() but also rcu_read_lock_sched() into account. */ #define rcu_dereference_sched_check(p, c) \ - __rcu_dereference_check((p), __UNIQUE_ID(rcu), \ + __rcu_dereference_check(p, __UNIQUE_ID(rcu), \ (c) || rcu_read_lock_sched_held(), \ __rcu) =20 @@ -651,7 +651,7 @@ do { \ * rcu_read_lock_held(). */ #define rcu_dereference_raw_check(p) \ - __rcu_dereference_check((p), __UNIQUE_ID(rcu), 1, __rcu) + __rcu_dereference_check(p, __UNIQUE_ID(rcu), 1, __rcu) =20 /** * rcu_dereference_protected() - fetch RCU pointer when updates prevented @@ -670,7 +670,7 @@ do { \ * but very ugly failures. */ #define rcu_dereference_protected(p, c) \ - __rcu_dereference_protected((p), __UNIQUE_ID(rcu), (c), __rcu) + __rcu_dereference_protected(p, __UNIQUE_ID(rcu), c, __rcu) =20 =20 /** @@ -1021,7 +1021,7 @@ static inline notrace void rcu_read_unlock_sched_notr= ace(void) #define KVFREE_GET_MACRO(_1, _2, NAME, ...) NAME #define kvfree_rcu_arg_2(ptr, rhf) \ do { \ - typeof (ptr) ___p =3D (ptr); \ + typeof(ptr) ___p =3D (ptr); \ \ if (___p) { \ BUILD_BUG_ON(!__is_kvfree_rcu_offset(offsetof(typeof(*(ptr)), rhf))); \ --=20 2.25.1 From nobody Wed Feb 11 19:28:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 696DFC77B78 for ; Thu, 4 May 2023 20:32:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229887AbjEDUcl (ORCPT ); Thu, 4 May 2023 16:32:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231137AbjEDUcU (ORCPT ); Thu, 4 May 2023 16:32:20 -0400 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B5EB19435; Thu, 4 May 2023 13:21:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1683230732; bh=W9zAZi8VwGgVLnwB1Kz05im9spQ0PM5+IFpjRSSrhRE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pP/WOQu25fetQ3sRoYaQurZejTtqepJNV9c4Kuqjs22wa8BGt5gMJ25ZiFCE0l0BI GNuj7gkGiKFbAbQ341x8qDNPFhW2niVnAQxIkb16dhbJPSn1pDjCi0Uu+A3ECdpZlb 2do0i0ahDdGKtSRaoXczdV/8LKiritrQ1vxfWre/+AtgKIv+8KtkI8oPKxXd7LAJl/ 8bqzLbzBQzeaaAjSJUXVWwB8pa0bNThwR3NUSqXqNaiJapkWuYtpYLrWgxlXsvFGEV i6DkCbILWnO5e3PBAepEhC3ZeeC2QTi+RJDi/azdj5WAmFqeh4M/ZUm63LzJkdS4me CSMnHx8BkUX1g== Received: from localhost.localdomain (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4QC4Ym0sqPzxRH; Thu, 4 May 2023 16:05:32 -0400 (EDT) From: Mathieu Desnoyers To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Steven Rostedt , Lai Jiangshan , Zqiang , rcu@vger.kernel.org Subject: [RFC PATCH 02/13] rculist.h: Fix parentheses around macro pointer parameter use Date: Thu, 4 May 2023 16:05:16 -0400 Message-Id: <20230504200527.1935944-3-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> References: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add missing parentheses around use of macro argument "pos" in those patterns to ensure operator precedence behaves as expected: - typeof(*pos) - pos->member This corrects the following usage pattern where operator precedence is unexpected: LIST_HEAD(testlist); struct test { struct list_head node; int a; }; // pos->member issue void f(void) { struct test *t1; struct test **t2 =3D &t1; list_for_each_entry_rcu((*t2), &testlist, node) { /* works = */ //... } list_for_each_entry_rcu(*t2, &testlist, node) { /* broken */ //... } } The typeof(*pos) lack of parentheses around "pos" is not an issue per se in the specific macros modified here because "pos" is used as an lvalue, which should prevent use of any operator causing issue. Still add the extra parentheses for consistency. Signed-off-by: Mathieu Desnoyers Cc: "Paul E. McKenney" Cc: Andrew Morton Cc: Frederic Weisbecker Cc: Neeraj Upadhyay Cc: Joel Fernandes Cc: Josh Triplett Cc: Boqun Feng Cc: Steven Rostedt Cc: Lai Jiangshan Cc: Zqiang Cc: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- include/linux/rculist.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/include/linux/rculist.h b/include/linux/rculist.h index d29740be4833..d27aeff5447d 100644 --- a/include/linux/rculist.h +++ b/include/linux/rculist.h @@ -388,9 +388,9 @@ static inline void list_splice_tail_init_rcu(struct lis= t_head *list, */ #define list_for_each_entry_rcu(pos, head, member, cond...) \ for (__list_check_rcu(dummy, ## cond, 0), \ - pos =3D list_entry_rcu((head)->next, typeof(*pos), member); \ - &pos->member !=3D (head); \ - pos =3D list_entry_rcu(pos->member.next, typeof(*pos), member)) + pos =3D list_entry_rcu((head)->next, typeof(*(pos)), member);\ + &(pos)->member !=3D (head); \ + pos =3D list_entry_rcu((pos)->member.next, typeof(*(pos)), member)) =20 /** * list_for_each_entry_srcu - iterate over rcu list of given type @@ -407,9 +407,9 @@ static inline void list_splice_tail_init_rcu(struct lis= t_head *list, */ #define list_for_each_entry_srcu(pos, head, member, cond) \ for (__list_check_srcu(cond), \ - pos =3D list_entry_rcu((head)->next, typeof(*pos), member); \ - &pos->member !=3D (head); \ - pos =3D list_entry_rcu(pos->member.next, typeof(*pos), member)) + pos =3D list_entry_rcu((head)->next, typeof(*(pos)), member);\ + &(pos)->member !=3D (head); \ + pos =3D list_entry_rcu((pos)->member.next, typeof(*(pos)), member)) =20 /** * list_entry_lockless - get the struct for this entry @@ -441,9 +441,9 @@ static inline void list_splice_tail_init_rcu(struct lis= t_head *list, * but never deleted. */ #define list_for_each_entry_lockless(pos, head, member) \ - for (pos =3D list_entry_lockless((head)->next, typeof(*pos), member); \ - &pos->member !=3D (head); \ - pos =3D list_entry_lockless(pos->member.next, typeof(*pos), member)) + for (pos =3D list_entry_lockless((head)->next, typeof(*(pos)), member); \ + &(pos)->member !=3D (head); \ + pos =3D list_entry_lockless((pos)->member.next, typeof(*(pos)), memb= er)) =20 /** * list_for_each_entry_continue_rcu - continue iteration over list of give= n type @@ -464,9 +464,9 @@ static inline void list_splice_tail_init_rcu(struct lis= t_head *list, * position. */ #define list_for_each_entry_continue_rcu(pos, head, member) \ - for (pos =3D list_entry_rcu(pos->member.next, typeof(*pos), member); \ - &pos->member !=3D (head); \ - pos =3D list_entry_rcu(pos->member.next, typeof(*pos), member)) + for (pos =3D list_entry_rcu((pos)->member.next, typeof(*(pos)), member); \ + &(pos)->member !=3D (head); \ + pos =3D list_entry_rcu((pos)->member.next, typeof(*(pos)), member)) =20 /** * list_for_each_entry_from_rcu - iterate over a list from current point @@ -486,8 +486,8 @@ static inline void list_splice_tail_init_rcu(struct lis= t_head *list, * after the given position. */ #define list_for_each_entry_from_rcu(pos, head, member) \ - for (; &(pos)->member !=3D (head); \ - pos =3D list_entry_rcu(pos->member.next, typeof(*(pos)), member)) + for (; &(pos)->member !=3D (head); \ + pos =3D list_entry_rcu((pos)->member.next, typeof(*(pos)), member)) =20 /** * hlist_del_rcu - deletes entry from hash list without re-initialization --=20 2.25.1 From nobody Wed Feb 11 19:28:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E04BC7EE21 for ; Thu, 4 May 2023 21:01:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230079AbjEDVBj (ORCPT ); Thu, 4 May 2023 17:01:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230369AbjEDVBS (ORCPT ); Thu, 4 May 2023 17:01:18 -0400 Received: from smtpout.efficios.com (unknown [IPv6:2607:5300:203:b2ee::31e5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0E8313C10; Thu, 4 May 2023 14:00:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1683230732; bh=D/NfiDdblr1nISgkSaCGt1uzTz4bykGLb/1bVKOEMww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N0jaaMPNt4wgec6S+UXVf+cRhRvvT7e7d14PG5ZkCYpwfQLOYyu0n1nDOZ8A6bhye ut3K1V5mWn/K8ziXFRU222jQPbdpUQti5+xKhlOuewRc8MWNrqDlJsRURvhWRSVT0t JMUnH3+xGstJ6bHBVPMTU8yrcg37TV3CFoIK0/1pOgHNMP8MxJbMQvtiqUiUAX5vjB Frip0V51Cjqsk/ZCtfgWKK0tjDkrEEN7Uj22K+8O2hqobuOOuAEzgaeKRgXU1cIAou ze0+ixYVLRr909UzlBGQf6Z4zQu4zA8gsElrCqoImMeu58ksiVa6D5N6HXYmnUdgvj sxdzMviQL1VRw== Received: from localhost.localdomain (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4QC4Ym3GV2z122c; Thu, 4 May 2023 16:05:32 -0400 (EDT) From: Mathieu Desnoyers To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Alexei Starovoitov , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Steven Rostedt , Lai Jiangshan , Zqiang , rcu@vger.kernel.org Subject: [RFC PATCH 03/13] rculist_nulls.h: Add parentheses around macro pointer parameter use Date: Thu, 4 May 2023 16:05:17 -0400 Message-Id: <20230504200527.1935944-4-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> References: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add parentheses around use of macro argument "tpos" in those patterns to ensure operator precedence behaves as expected: - typeof(*tpos) The typeof(*tpos) lack of parentheses around "tpos" is not an issue per se in the specific macros modified here because "tpos" is used as an lvalue, which should prevent use of any operator causing issue. Still add the extra parentheses for consistency with other list iteration code across the kernel tree. Signed-off-by: Mathieu Desnoyers Cc: Andrew Morton Cc: Alexei Starovoitov Cc: "Paul E. McKenney" Cc: Andrew Morton Cc: Frederic Weisbecker Cc: Neeraj Upadhyay Cc: Joel Fernandes Cc: Josh Triplett Cc: Boqun Feng Cc: Steven Rostedt Cc: Lai Jiangshan Cc: Zqiang Cc: rcu@vger.kernel.org --- include/linux/rculist_nulls.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/rculist_nulls.h b/include/linux/rculist_nulls.h index ba4c00dd8005..6e56dd2daecf 100644 --- a/include/linux/rculist_nulls.h +++ b/include/linux/rculist_nulls.h @@ -168,7 +168,7 @@ static inline void hlist_nulls_add_fake(struct hlist_nu= lls_node *n) for (({barrier();}), \ pos =3D rcu_dereference_raw(hlist_nulls_first_rcu(head)); \ (!is_a_nulls(pos)) && \ - ({ tpos =3D hlist_nulls_entry(pos, typeof(*tpos), member); 1; }); \ + ({ tpos =3D hlist_nulls_entry(pos, typeof(*(tpos)), member); 1; }); \ pos =3D rcu_dereference_raw(hlist_nulls_next_rcu(pos))) =20 /** @@ -183,7 +183,7 @@ static inline void hlist_nulls_add_fake(struct hlist_nu= lls_node *n) for (({barrier();}), \ pos =3D rcu_dereference_raw(hlist_nulls_first_rcu(head)); \ (!is_a_nulls(pos)) && \ - ({ tpos =3D hlist_nulls_entry(pos, typeof(*tpos), member); \ + ({ tpos =3D hlist_nulls_entry(pos, typeof(*(tpos)), member); \ pos =3D rcu_dereference_raw(hlist_nulls_next_rcu(pos)); 1; });) #endif #endif --=20 2.25.1 From nobody Wed Feb 11 19:28:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC9BDC77B7C for ; Thu, 4 May 2023 20:32:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231381AbjEDUci (ORCPT ); Thu, 4 May 2023 16:32:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231196AbjEDUcU (ORCPT ); Thu, 4 May 2023 16:32:20 -0400 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9267E19434; Thu, 4 May 2023 13:22:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1683230733; bh=ZEKk2l+avXLFbsd5WjSG9znQ65K2KXiDXgyV8vZ7EJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IfKCIjYQSXozgD4Wb+wSwBd+stdAcMsdT2i7VdXVhDqafbIW98tLuRfWIBLQZ+upQ 5cHlYfTa3Xacv7BcJRQjH/KgIlprqL2os0yCC4v5U1jBnVjjzAOo8SbzbhlzvKzMbr xsgD+dGSe18n+gif1kzPhm7D/VrQEw+jlmdRLLTOHI+fz8FHAT+PohpHF2J7q1HDPH x2iH82MRkVPYP9LF5JDu/DNky5u5fcl2ZbUWmIH8cL3c6qvJNMbGCOILIGskgK9xjy OpOb1k8U26ecYsStldMJQXyZQUN/oCdD/EusL/yddPWCrmAcHo8IK1GDvFgkHgoSZ6 9raHAvS4UD5rg== Received: from localhost.localdomain (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4QC4Ym5dLWzxRJ; Thu, 4 May 2023 16:05:32 -0400 (EDT) From: Mathieu Desnoyers To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Steven Rostedt , Lai Jiangshan , Zqiang , rcu@vger.kernel.org Subject: [RFC PATCH 04/13] rculist_bl.h: Fix parentheses around macro pointer parameter use Date: Thu, 4 May 2023 16:05:18 -0400 Message-Id: <20230504200527.1935944-5-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> References: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add missing parentheses around use of macro argument "tpos" in those patterns to ensure operator precedence behaves as expected: - typeof(*tpos) - pos->next - x && y is changed for (x) && (y). The typeof(*tpos) lack of parentheses around "tpos" is not an issue per se in the specific macros modified here because "tpos" is used as an lvalue, which should prevent use of any operator causing issue. Still add the extra parentheses for consistency. Signed-off-by: Mathieu Desnoyers Cc: Andrew Morton Cc: "Paul E. McKenney" Cc: Andrew Morton Cc: Frederic Weisbecker Cc: Neeraj Upadhyay Cc: Joel Fernandes Cc: Josh Triplett Cc: Boqun Feng Cc: Steven Rostedt Cc: Lai Jiangshan Cc: Zqiang Cc: rcu@vger.kernel.org --- include/linux/rculist_bl.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/rculist_bl.h b/include/linux/rculist_bl.h index 0b952d06eb0b..798c0a03bf5c 100644 --- a/include/linux/rculist_bl.h +++ b/include/linux/rculist_bl.h @@ -94,8 +94,8 @@ static inline void hlist_bl_add_head_rcu(struct hlist_bl_= node *n, */ #define hlist_bl_for_each_entry_rcu(tpos, pos, head, member) \ for (pos =3D hlist_bl_first_rcu(head); \ - pos && \ - ({ tpos =3D hlist_bl_entry(pos, typeof(*tpos), member); 1; }); \ - pos =3D rcu_dereference_raw(pos->next)) + (pos) && \ + ({ tpos =3D hlist_bl_entry(pos, typeof(*(tpos)), member); 1; }); \ + pos =3D rcu_dereference_raw((pos)->next)) =20 #endif --=20 2.25.1 From nobody Wed Feb 11 19:28:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A1CFC7EE21 for ; Thu, 4 May 2023 21:01:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230346AbjEDVBf (ORCPT ); Thu, 4 May 2023 17:01:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229731AbjEDVBP (ORCPT ); Thu, 4 May 2023 17:01:15 -0400 Received: from smtpout.efficios.com (unknown [IPv6:2607:5300:203:b2ee::31e5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C737D13290 for ; Thu, 4 May 2023 14:00:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1683230733; bh=ejcZRhDyFKbQO0Pq2uphS/at1qd6mS5DdbQdmXOnDzQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RtnX8wDZcF6Jl+yg7Dd9MSRqmNfuJYg1Un9qlf5XhMvxdr7G3SPJ/NC7b1o0U9QqO xNNKCrM3RFPuHBRWMX+pbAOtU94c/g8K1MJU0el1F3YlFSF7/SjANB97oUp1US8g0J UxTEkVNVZwlmjmGS1aBGe9SsZ3VpWXSKRUvWu3Lqq9qoURob4coNjaJISbSgUX1s3j Anak7Axro4o4SYd8WD2cOd+aVuCq5K+uK3qdUX0vVv9SSVXEkiSt7D5CUPNO1DMv+2 oGikVrgtWGdvksFhIcg3vSW6JI7vKEVlBfKdpSWREnRpNFOL6qvBmK1E8wORIWPnLu TE7ZR+jxlRkEg== Received: from localhost.localdomain (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4QC4Yn0vBhz122d; Thu, 4 May 2023 16:05:33 -0400 (EDT) From: Mathieu Desnoyers To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Greg Kroah-Hartman , Andy Shevchenko , David Howells , Ricardo Martinez Subject: [RFC PATCH 05/13] list.h: Fix parentheses around macro pointer parameter use Date: Thu, 4 May 2023 16:05:19 -0400 Message-Id: <20230504200527.1935944-6-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> References: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add missing parentheses around use of macro argument "pos" in those patterns to ensure operator precedence behaves as expected: - typeof(*pos) - pos->member - "x =3D y" is changed for "x =3D (y)", because "y" can be an expression containing a comma if it is the result of the expansion of a macro such as #define eval(...) __VA_ARGS__, which would cause unexpected operator precedence. This use-case is far-fetched, but we have to choose one way or the other (with or without parentheses) for consistency, - x && y is changed for (x) && (y). Remove useless parentheses around use of macro parameter (head) in the following pattern: - list_is_head(pos, (head)) Because comma is the lowest priority operator already, so the extra pair of parentheses is redundant. This corrects the following usage pattern where operator precedence is unexpected: LIST_HEAD(testlist); struct test { struct list_head node; int a; }; // pos->member issue void f(void) { struct test *t1; struct test **t2 =3D &t1; list_for_each_entry((*t2), &testlist, node) { /* works */ //... } list_for_each_entry(*t2, &testlist, node) { /* broken */ //... } } // typeof(*pos) issue void f2(void) { struct test *t1 =3D NULL, *t2; t2 =3D list_prepare_entry((0 + t1), &testlist, node); /* work= s */ t2 =3D list_prepare_entry(0 + t1, &testlist, node); /* brok= en */ } Note that the macros in which "pos" is also used as an lvalue probably don't suffer from the lack of parentheses around "pos" in typeof(*pos), but add those nevertheless to keep everything consistent. Signed-off-by: Mathieu Desnoyers Cc: Andrew Morton Cc: Greg Kroah-Hartman Cc: Andy Shevchenko Cc: David Howells Cc: Ricardo Martinez --- include/linux/list.h | 54 ++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/include/linux/list.h b/include/linux/list.h index f10344dbad4d..d197b1a6f411 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -603,7 +603,7 @@ static inline void list_splice_tail_init(struct list_he= ad *list, * @head: the head for your list. */ #define list_for_each(pos, head) \ - for (pos =3D (head)->next; !list_is_head(pos, (head)); pos =3D pos->next) + for (pos =3D (head)->next; !list_is_head(pos, head); pos =3D (pos)->next) =20 /** * list_for_each_rcu - Iterate over a list in an RCU-safe fashion @@ -612,8 +612,8 @@ static inline void list_splice_tail_init(struct list_he= ad *list, */ #define list_for_each_rcu(pos, head) \ for (pos =3D rcu_dereference((head)->next); \ - !list_is_head(pos, (head)); \ - pos =3D rcu_dereference(pos->next)) + !list_is_head(pos, head); \ + pos =3D rcu_dereference((pos)->next)) =20 /** * list_for_each_continue - continue iteration over a list @@ -623,7 +623,7 @@ static inline void list_splice_tail_init(struct list_he= ad *list, * Continue to iterate over a list, continuing after the current position. */ #define list_for_each_continue(pos, head) \ - for (pos =3D pos->next; !list_is_head(pos, (head)); pos =3D pos->next) + for (pos =3D (pos)->next; !list_is_head(pos, head); pos =3D (pos)->next) =20 /** * list_for_each_prev - iterate over a list backwards @@ -631,7 +631,7 @@ static inline void list_splice_tail_init(struct list_he= ad *list, * @head: the head for your list. */ #define list_for_each_prev(pos, head) \ - for (pos =3D (head)->prev; !list_is_head(pos, (head)); pos =3D pos->prev) + for (pos =3D (head)->prev; !list_is_head(pos, head); pos =3D (pos)->prev) =20 /** * list_for_each_safe - iterate over a list safe against removal of list e= ntry @@ -640,9 +640,9 @@ static inline void list_splice_tail_init(struct list_he= ad *list, * @head: the head for your list. */ #define list_for_each_safe(pos, n, head) \ - for (pos =3D (head)->next, n =3D pos->next; \ - !list_is_head(pos, (head)); \ - pos =3D n, n =3D pos->next) + for (pos =3D (head)->next, n =3D (pos)->next; \ + !list_is_head(pos, head); \ + pos =3D (n), n =3D (pos)->next) =20 /** * list_for_each_prev_safe - iterate over a list backwards safe against re= moval of list entry @@ -651,9 +651,9 @@ static inline void list_splice_tail_init(struct list_he= ad *list, * @head: the head for your list. */ #define list_for_each_prev_safe(pos, n, head) \ - for (pos =3D (head)->prev, n =3D pos->prev; \ - !list_is_head(pos, (head)); \ - pos =3D n, n =3D pos->prev) + for (pos =3D (head)->prev, n =3D (pos)->prev; \ + !list_is_head(pos, head); \ + pos =3D (n), n =3D (pos)->prev) =20 /** * list_count_nodes - count nodes in the list @@ -677,7 +677,7 @@ static inline size_t list_count_nodes(struct list_head = *head) * @member: the name of the list_head within the struct. */ #define list_entry_is_head(pos, head, member) \ - (&pos->member =3D=3D (head)) + (&(pos)->member =3D=3D (head)) =20 /** * list_for_each_entry - iterate over list of given type @@ -686,7 +686,7 @@ static inline size_t list_count_nodes(struct list_head = *head) * @member: the name of the list_head within the struct. */ #define list_for_each_entry(pos, head, member) \ - for (pos =3D list_first_entry(head, typeof(*pos), member); \ + for (pos =3D list_first_entry(head, typeof(*(pos)), member); \ !list_entry_is_head(pos, head, member); \ pos =3D list_next_entry(pos, member)) =20 @@ -697,7 +697,7 @@ static inline size_t list_count_nodes(struct list_head = *head) * @member: the name of the list_head within the struct. */ #define list_for_each_entry_reverse(pos, head, member) \ - for (pos =3D list_last_entry(head, typeof(*pos), member); \ + for (pos =3D list_last_entry(head, typeof(*(pos)), member); \ !list_entry_is_head(pos, head, member); \ pos =3D list_prev_entry(pos, member)) =20 @@ -710,7 +710,7 @@ static inline size_t list_count_nodes(struct list_head = *head) * Prepares a pos entry for use as a start point in list_for_each_entry_co= ntinue(). */ #define list_prepare_entry(pos, head, member) \ - ((pos) ? : list_entry(head, typeof(*pos), member)) + ((pos) ? : list_entry(head, typeof(*(pos)), member)) =20 /** * list_for_each_entry_continue - continue iteration over list of given ty= pe @@ -773,10 +773,10 @@ static inline size_t list_count_nodes(struct list_hea= d *head) * @member: the name of the list_head within the struct. */ #define list_for_each_entry_safe(pos, n, head, member) \ - for (pos =3D list_first_entry(head, typeof(*pos), member), \ + for (pos =3D list_first_entry(head, typeof(*(pos)), member), \ n =3D list_next_entry(pos, member); \ !list_entry_is_head(pos, head, member); \ - pos =3D n, n =3D list_next_entry(n, member)) + pos =3D (n), n =3D list_next_entry(n, member)) =20 /** * list_for_each_entry_safe_continue - continue list iteration safe agains= t removal @@ -792,7 +792,7 @@ static inline size_t list_count_nodes(struct list_head = *head) for (pos =3D list_next_entry(pos, member), \ n =3D list_next_entry(pos, member); \ !list_entry_is_head(pos, head, member); \ - pos =3D n, n =3D list_next_entry(n, member)) + pos =3D (n), n =3D list_next_entry(n, member)) =20 /** * list_for_each_entry_safe_from - iterate over list from current point sa= fe against removal @@ -807,7 +807,7 @@ static inline size_t list_count_nodes(struct list_head = *head) #define list_for_each_entry_safe_from(pos, n, head, member) \ for (n =3D list_next_entry(pos, member); \ !list_entry_is_head(pos, head, member); \ - pos =3D n, n =3D list_next_entry(n, member)) + pos =3D (n), n =3D list_next_entry(n, member)) =20 /** * list_for_each_entry_safe_reverse - iterate backwards over list safe aga= inst removal @@ -820,10 +820,10 @@ static inline size_t list_count_nodes(struct list_hea= d *head) * of list entry. */ #define list_for_each_entry_safe_reverse(pos, n, head, member) \ - for (pos =3D list_last_entry(head, typeof(*pos), member), \ + for (pos =3D list_last_entry(head, typeof(*(pos)), member), \ n =3D list_prev_entry(pos, member); \ !list_entry_is_head(pos, head, member); \ - pos =3D n, n =3D list_prev_entry(n, member)) + pos =3D (n), n =3D list_prev_entry(n, member)) =20 /** * list_safe_reset_next - reset a stale list_for_each_entry_safe loop @@ -1033,11 +1033,11 @@ static inline void hlist_move_list(struct hlist_hea= d *old, #define hlist_entry(ptr, type, member) container_of(ptr,type,member) =20 #define hlist_for_each(pos, head) \ - for (pos =3D (head)->first; pos ; pos =3D pos->next) + for (pos =3D (head)->first; pos ; pos =3D (pos)->next) =20 #define hlist_for_each_safe(pos, n, head) \ - for (pos =3D (head)->first; pos && ({ n =3D pos->next; 1; }); \ - pos =3D n) + for (pos =3D (head)->first; (pos) && ({ n =3D (pos)->next; 1; }); \ + pos =3D (n)) =20 #define hlist_entry_safe(ptr, type, member) \ ({ typeof(ptr) ____ptr =3D (ptr); \ @@ -1082,8 +1082,8 @@ static inline void hlist_move_list(struct hlist_head = *old, * @member: the name of the hlist_node within the struct. */ #define hlist_for_each_entry_safe(pos, n, head, member) \ - for (pos =3D hlist_entry_safe((head)->first, typeof(*pos), member);\ - pos && ({ n =3D pos->member.next; 1; }); \ - pos =3D hlist_entry_safe(n, typeof(*pos), member)) + for (pos =3D hlist_entry_safe((head)->first, typeof(*(pos)), member);\ + (pos) && ({ n =3D (pos)->member.next; 1; }); \ + pos =3D hlist_entry_safe(n, typeof(*(pos)), member)) =20 #endif --=20 2.25.1 From nobody Wed Feb 11 19:28:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D41AC7EE21 for ; Thu, 4 May 2023 20:48:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229975AbjEDUsO (ORCPT ); Thu, 4 May 2023 16:48:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229996AbjEDUry (ORCPT ); Thu, 4 May 2023 16:47:54 -0400 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0725AD22 for ; Thu, 4 May 2023 13:47:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1683230733; bh=dMinXl77eDsU1Swj1Mb43GwAjcr/wXhk2zDxp1xftSo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QKHvDn6Hf3v0PHsQWe1RYRYUrA6cXCyH8x79TPvgUZp1EldRddS1HoRHyXcsej3KL MzttQmErR1tipru+dWJxiPqeOpKCqohr0r0M5qbIOZDWXzAmLatxqJ0tLt1uCERr7M Q1RjExLIPDuvuxS/aMp9Onj9KvtqU/4ZrjjOaZtq1NKCsBDDqRUcsYWyo4xfZ95yBG PUyU6YuACzZPsntH2K4lvKUXxuthxoyYcHxMO9vgdK2AOqRmCg5mK8kNG7hTuoX9W/ gz86VeH9i+KvGq8E07uXrGku3OO+Ub5r/oj/KUnkXfyjd3nMSC3dn7IEDYsroPjZDd V9kHHG34ChNxA== Received: from localhost.localdomain (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4QC4Yn2d43z11qs; Thu, 4 May 2023 16:05:33 -0400 (EDT) From: Mathieu Desnoyers To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Eric Dumazet Subject: [RFC PATCH 06/13] list_nulls.h: Fix parentheses around macro pointer parameter use Date: Thu, 4 May 2023 16:05:20 -0400 Message-Id: <20230504200527.1935944-7-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> References: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add missing parentheses around use of macro argument "pos" in those patterns to ensure operator precedence behaves as expected: - typeof(*tpos) - pos->next The typeof(*tpos) lack of parentheses around "tpos" is not an issue per se in the specific macros modified here because "tpos" is used as an lvalue, which should prevent use of any operator causing issue. Still add the extra parentheses for consistency. Signed-off-by: Mathieu Desnoyers Cc: Andrew Morton Cc: Eric Dumazet --- include/linux/list_nulls.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/list_nulls.h b/include/linux/list_nulls.h index fa6e8471bd22..74ffde881e44 100644 --- a/include/linux/list_nulls.h +++ b/include/linux/list_nulls.h @@ -127,8 +127,8 @@ static inline void hlist_nulls_del(struct hlist_nulls_n= ode *n) #define hlist_nulls_for_each_entry(tpos, pos, head, member) \ for (pos =3D (head)->first; \ (!is_a_nulls(pos)) && \ - ({ tpos =3D hlist_nulls_entry(pos, typeof(*tpos), member); 1;}); \ - pos =3D pos->next) + ({ tpos =3D hlist_nulls_entry(pos, typeof(*(tpos)), member); 1;}); \ + pos =3D (pos)->next) =20 /** * hlist_nulls_for_each_entry_from - iterate over a hlist continuing from = current point @@ -139,7 +139,7 @@ static inline void hlist_nulls_del(struct hlist_nulls_n= ode *n) */ #define hlist_nulls_for_each_entry_from(tpos, pos, member) \ for (; (!is_a_nulls(pos)) && \ - ({ tpos =3D hlist_nulls_entry(pos, typeof(*tpos), member); 1;}); \ - pos =3D pos->next) + ({ tpos =3D hlist_nulls_entry(pos, typeof(*(tpos)), member); 1;}); \ + pos =3D (pos)->next) =20 #endif --=20 2.25.1 From nobody Wed Feb 11 19:28:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EB95C7EE21 for ; Thu, 4 May 2023 20:52:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230106AbjEDUwP (ORCPT ); Thu, 4 May 2023 16:52:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229626AbjEDUwM (ORCPT ); Thu, 4 May 2023 16:52:12 -0400 Received: from smtpout.efficios.com (unknown [IPv6:2607:5300:203:b2ee::31e5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9ECD93FE for ; Thu, 4 May 2023 13:51:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1683230733; bh=d1KfLyc6kB5wDCv4ypHLZjfVgQsbxIXbUETDS35Ubh0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=toqxukN7T7Av2eyJcYL2ReSsGzK35iliPKL5M9vE69O5uZjYjlUmjCXQrvge67SxK hP9j6ab2jjsexqBW5FeevpasCXjAp+BCOdVUEy5fj7Wsu76oJrbE+jcBb6E3K1J0S6 a/DB/3f2G1yaU2zI24mI8/oZ9SziaFFLNf99ryEp8mnnwAZC8UeoqW6vxn9VWnE9NF SzcMpF+SbmjpAB2+18ZxFWorz57tY7oOcbmcXwkafxxBX84WvWHBoQ3OfRUj0qy8kG TgotT3nEWmSh86Z1yYRb6zKbuqlRMW4G8iKlykQDNbMuWFKcbYze6Oacc3KXPhIu3+ 60KbS6+/3qpzA== Received: from localhost.localdomain (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4QC4Yn3w9Nz11qt; Thu, 4 May 2023 16:05:33 -0400 (EDT) From: Mathieu Desnoyers To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Nick Piggin Subject: [RFC PATCH 07/13] list_bl.h: Fix parentheses around macro pointer parameter use Date: Thu, 4 May 2023 16:05:21 -0400 Message-Id: <20230504200527.1935944-8-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> References: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add missing parentheses around use of macro argument "tpos" in those patterns to ensure operator precedence behaves as expected: - typeof(*tpos) - pos->next - "x =3D y" is changed for "x =3D (y)", because "y" can be an expression containing a comma if it is the result of the expansion of a macro such as #define eval(...) __VA_ARGS__, which would cause unexpected operator precedence. This use-case is far-fetched, but we have to choose one way or the other (with or without parentheses) for consistency. - x && y is changed for (x) && (y). The typeof(*tpos) lack of parentheses around "tpos" is not an issue per se in the specific macros modified here because "tpos" is used as an lvalue, which should prevent use of any operator causing issue. Still add the extra parentheses for consistency. Signed-off-by: Mathieu Desnoyers Cc: Andrew Morton Cc: Nick Piggin --- include/linux/list_bl.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/linux/list_bl.h b/include/linux/list_bl.h index ae1b541446c9..450cca15496b 100644 --- a/include/linux/list_bl.h +++ b/include/linux/list_bl.h @@ -168,9 +168,9 @@ static inline bool hlist_bl_is_locked(struct hlist_bl_h= ead *b) */ #define hlist_bl_for_each_entry(tpos, pos, head, member) \ for (pos =3D hlist_bl_first(head); \ - pos && \ - ({ tpos =3D hlist_bl_entry(pos, typeof(*tpos), member); 1;}); \ - pos =3D pos->next) + (pos) && \ + ({ tpos =3D hlist_bl_entry(pos, typeof(*(tpos)), member); 1;}); \ + pos =3D (pos)->next) =20 /** * hlist_bl_for_each_entry_safe - iterate over list of given type safe aga= inst removal of list entry @@ -182,8 +182,8 @@ static inline bool hlist_bl_is_locked(struct hlist_bl_h= ead *b) */ #define hlist_bl_for_each_entry_safe(tpos, pos, n, head, member) \ for (pos =3D hlist_bl_first(head); \ - pos && ({ n =3D pos->next; 1; }) && \ - ({ tpos =3D hlist_bl_entry(pos, typeof(*tpos), member); 1;}); \ - pos =3D n) + (pos) && ({ n =3D (pos)->next; 1; }) && \ + ({ tpos =3D hlist_bl_entry(pos, typeof(*(tpos)), member); 1;}); \ + pos =3D (n)) =20 #endif --=20 2.25.1 From nobody Wed Feb 11 19:28:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A650C7EE22 for ; Thu, 4 May 2023 20:48:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230028AbjEDUsR (ORCPT ); Thu, 4 May 2023 16:48:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230008AbjEDUrz (ORCPT ); Thu, 4 May 2023 16:47:55 -0400 Received: from smtpout.efficios.com (unknown [IPv6:2607:5300:203:b2ee::31e5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 624E9AD32 for ; Thu, 4 May 2023 13:47:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1683230733; bh=lMtgOxwdzX0uFY+dt+rni4n4Qsyjrfo6DEFUPcpl8ZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fFma/8uB9FrnwdLgMUbByiIiA8Hs/uH8qtZGJZRYqQPgadYcdw1PlXB9LDBtfra97 DeZL1N80zOyn6fvgwXRkthYRIG7bIsKysrcsLGoKj7N+mdmFKYvljaJ8W4RWkoK7BT Ih6EfdFIwq0dTqc9z1uevqKs8p59fJdB+xeJp2zZ85vEl6twos79ZLSTDJV/MEUoud RRksmMSyHeAZGK7SVbR2JsTPcIf340qNmlPh8lvc7Ex/MnNuBqa+ku09Oh4fDGVgzb g2d3IjTPh1hHOQdOrxtb6+iUBTPJ7KftPMIBzVQKrMDo0qUR4ySVQEcnkuvxQxyJyz 46bI38/F4rnNw== Received: from localhost.localdomain (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4QC4Yn5ZnSz11lP; Thu, 4 May 2023 16:05:33 -0400 (EDT) From: Mathieu Desnoyers To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Huang Ying , Peter Zijlstra Subject: [RFC PATCH 08/13] llist.h: Fix parentheses around macro pointer parameter use Date: Thu, 4 May 2023 16:05:22 -0400 Message-Id: <20230504200527.1935944-9-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> References: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add missing parentheses around use of macro argument "pos" in those patterns to ensure operator precedence behaves as expected: - typeof(*pos) - pos->member - "x =3D y" is changed for "x =3D (y)", because "y" can be an expression containing a comma if it is the result of the expansion of a macro such as #define eval(...) __VA_ARGS__, which would cause unexpected operator precedence. This use-case is far-fetched, but we have to choose one way or the other (with or without parentheses) for consistency. The typeof(*pos) lack of parentheses around "pos" is not an issue per se in the specific macros modified here because "pos" is used as an lvalue, which should prevent use of any operator causing issue. Still add the extra parentheses for consistency. Remove useless parentheses around use of macro parameter (node) in the following patterns: - llist_entry((node), typeof(*(pos)), member) is changed for llist_entry(node, typeof(*(pos)), member), - "(pos) =3D (node)" is changed for "pos =3D (node)". Because comma is the lowest priority operator already, so the extra pair of parentheses is redundant. Signed-off-by: Mathieu Desnoyers Cc: Andrew Morton Cc: Huang Ying Cc: Peter Zijlstra --- include/linux/llist.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/llist.h b/include/linux/llist.h index 85bda2d02d65..4181b34b557f 100644 --- a/include/linux/llist.h +++ b/include/linux/llist.h @@ -114,7 +114,7 @@ static inline void init_llist_head(struct llist_head *l= ist) * reverse the order by yourself before traversing. */ #define llist_for_each(pos, node) \ - for ((pos) =3D (node); pos; (pos) =3D (pos)->next) + for (pos =3D (node); pos; pos =3D (pos)->next) =20 /** * llist_for_each_safe - iterate over some deleted entries of a lock-less = list @@ -133,7 +133,7 @@ static inline void init_llist_head(struct llist_head *l= ist) * reverse the order by yourself before traversing. */ #define llist_for_each_safe(pos, n, node) \ - for ((pos) =3D (node); (pos) && ((n) =3D (pos)->next, true); (pos) =3D (n= )) + for (pos =3D (node); (pos) && (n =3D (pos)->next, true); pos =3D (n)) =20 /** * llist_for_each_entry - iterate over some deleted entries of lock-less l= ist of given type @@ -151,9 +151,9 @@ static inline void init_llist_head(struct llist_head *l= ist) * reverse the order by yourself before traversing. */ #define llist_for_each_entry(pos, node, member) \ - for ((pos) =3D llist_entry((node), typeof(*(pos)), member); \ + for (pos =3D llist_entry(node, typeof(*(pos)), member); \ member_address_is_nonnull(pos, member); \ - (pos) =3D llist_entry((pos)->member.next, typeof(*(pos)), member)) + pos =3D llist_entry((pos)->member.next, typeof(*(pos)), member)) =20 /** * llist_for_each_entry_safe - iterate over some deleted entries of lock-l= ess list of given type @@ -173,10 +173,10 @@ static inline void init_llist_head(struct llist_head = *list) * reverse the order by yourself before traversing. */ #define llist_for_each_entry_safe(pos, n, node, member) \ - for (pos =3D llist_entry((node), typeof(*pos), member); \ + for (pos =3D llist_entry(node, typeof(*(pos)), member); \ member_address_is_nonnull(pos, member) && \ - (n =3D llist_entry(pos->member.next, typeof(*n), member), true); \ - pos =3D n) + (n =3D llist_entry((pos)->member.next, typeof(*(n)), member), true); \ + pos =3D (n)) =20 /** * llist_empty - tests whether a lock-less list is empty --=20 2.25.1 From nobody Wed Feb 11 19:28:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACA86C7EE22 for ; Thu, 4 May 2023 20:52:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230100AbjEDUwS (ORCPT ); Thu, 4 May 2023 16:52:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229607AbjEDUwM (ORCPT ); Thu, 4 May 2023 16:52:12 -0400 Received: from smtpout.efficios.com (unknown [IPv6:2607:5300:203:b2ee::31e5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A80E41982 for ; Thu, 4 May 2023 13:51:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1683230734; bh=dJQRAkXY/sZd+jGAwjtNNNkqluNx5CFdlblILWEd/ho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jxPC214CyqN3DWs2Lz4/8H6/dXwg9FXVbDVTrZWqDb53iOczpo8qSltyhMXsKwuUh mSGGhtlybyKW4PFy+3RZ0T4kXVvvAKZfEfsw595k3mDQC88GSyd96HZKORmxy7TUVi 4x2hGCby5njBz7+1n1eHcSfOKRHXatuQfYo+JlzLfz5vtcR0IAKJSPVydnIwfIbixw YieXJzykgzJAAgUD7XiTv1NnDBZwtM7iPetRzlC1GsbFhNJAtPtWCsvcpc+RvXvzil tAVfs5s2eRdOsvr6/BJll1vB+hBp0drnQl1WEsbZpdrfIJp6nMwYZxHksGKdNsok70 L+TBIKiWk4Ulg== Received: from localhost.localdomain (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4QC4Yn75Q6z11jG; Thu, 4 May 2023 16:05:33 -0400 (EDT) From: Mathieu Desnoyers To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Tejun Heo , Peter Zijlstra Subject: [RFC PATCH 09/13] klist.h: Fix parentheses around macro parameter use Date: Thu, 4 May 2023 16:05:23 -0400 Message-Id: <20230504200527.1935944-10-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> References: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add missing parentheses around "_name" parameter use in KLIST_INIT(). It keeps list macros consistent, and prevents unexpected operator precedence situations, for example: struct klist a[1] =3D { KLIST_INIT(*a, NULL, NULL) }; Where the "." operator within KLIST_INIT() is evaluated before the "*" operator. Add missing parentheses around macro parameter use in the following patterns to ensure operator precedence behaves as expected: - "x =3D y" is changed for "x =3D (y)", because "y" can be an expression containing a comma if it is the result of the expansion of a macro such as #define eval(...) __VA_ARGS__, which would cause unexpected operator precedence. This use-case is far-fetched, but we have to choose one way or the other (with or without parentheses) for consistency. Signed-off-by: Mathieu Desnoyers Cc: Andrew Morton Cc: Tejun Heo Cc: Peter Zijlstra --- include/linux/klist.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/klist.h b/include/linux/klist.h index b0f238f20dbb..d7e0612ca4ff 100644 --- a/include/linux/klist.h +++ b/include/linux/klist.h @@ -23,10 +23,10 @@ struct klist { } __attribute__ ((aligned (sizeof(void *)))); =20 #define KLIST_INIT(_name, _get, _put) \ - { .k_lock =3D __SPIN_LOCK_UNLOCKED(_name.k_lock), \ - .k_list =3D LIST_HEAD_INIT(_name.k_list), \ - .get =3D _get, \ - .put =3D _put, } + { .k_lock =3D __SPIN_LOCK_UNLOCKED((_name).k_lock), \ + .k_list =3D LIST_HEAD_INIT((_name).k_list), \ + .get =3D (_get), \ + .put =3D (_put), } =20 #define DEFINE_KLIST(_name, _get, _put) \ struct klist _name =3D KLIST_INIT(_name, _get, _put) --=20 2.25.1 From nobody Wed Feb 11 19:28:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BDD2C77B73 for ; Thu, 4 May 2023 21:02:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230475AbjEDVCN (ORCPT ); Thu, 4 May 2023 17:02:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230370AbjEDVBj (ORCPT ); Thu, 4 May 2023 17:01:39 -0400 Received: from smtpout.efficios.com (unknown [IPv6:2607:5300:203:b2ee::31e5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AA6A14E61 for ; Thu, 4 May 2023 14:01:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1683230734; bh=4SJMp1te2JkZx1CFuIwS27tlAnRiNSVpgrNwcTggKBQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O8/ofAq1zgKtNVBwizAqBo6VPHz1KvIuRHyyIfW/cPGoa7HBxwdD9IsDlm6MCfCtU 1Xq0ctKQjJZsSymzJWterSninx0fyNR8uNTt9RPL7HoqCGPi5ltJh72eT959mbzWgI enh/p1OD/wGmFU6zjf73ft0NWHva2NXDvyOaeyvmKW2J6w4fgUDmRMByTkDG/Yu87m HaISwZxSXkZzBXIqxuRTqQqcNofwWRm66ELNBvhTuDtu7UBZm2kD53A49JLxV+JThy cMYcG2P2Kx2EaxdL5zwM9Cz/N67dTecAMHrvHfzTAdLhGGJ7PidlDOgDOh5QOSn43U +E94H2JQg/gBw== Received: from localhost.localdomain (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4QC4Yp1R7Yz11jH; Thu, 4 May 2023 16:05:34 -0400 (EDT) From: Mathieu Desnoyers To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Jiang Liu Subject: [RFC PATCH 10/13] resource_ext.h: Remove useless parentheses around macro parameters Date: Thu, 4 May 2023 16:05:24 -0400 Message-Id: <20230504200527.1935944-11-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> References: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Parentheses around macro parameters which are surrounded by commas is a scenario where those added parentheses are useless, because the comma is the operator with the lowest precedence. Remove those useless parentheses to make list iteration code consistent across kernel headers. Signed-off-by: Mathieu Desnoyers Cc: Andrew Morton Cc: Jiang Liu --- include/linux/resource_ext.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/resource_ext.h b/include/linux/resource_ext.h index ff0339df56af..f4a3c0040886 100644 --- a/include/linux/resource_ext.h +++ b/include/linux/resource_ext.h @@ -60,11 +60,11 @@ resource_list_destroy_entry(struct resource_entry *entr= y) resource_list_free_entry(entry); } =20 -#define resource_list_for_each_entry(entry, list) \ - list_for_each_entry((entry), (list), node) +#define resource_list_for_each_entry(entry, list) \ + list_for_each_entry(entry, list, node) =20 #define resource_list_for_each_entry_safe(entry, tmp, list) \ - list_for_each_entry_safe((entry), (tmp), (list), node) + list_for_each_entry_safe(entry, tmp, list, node) =20 static inline struct resource_entry * resource_list_first_type(struct list_head *list, unsigned long type) --=20 2.25.1 From nobody Wed Feb 11 19:28:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1953BC77B73 for ; Thu, 4 May 2023 21:02:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230440AbjEDVCX (ORCPT ); Thu, 4 May 2023 17:02:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230502AbjEDVBo (ORCPT ); Thu, 4 May 2023 17:01:44 -0400 Received: from smtpout.efficios.com (unknown [IPv6:2607:5300:203:b2ee::31e5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A04CCAD25; Thu, 4 May 2023 14:01:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1683230734; bh=4eWXzqJGW3r8CsJlCJi50P2D2+UPMfjU80F5mDNGm64=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j4elbQnqRi3jTLzFpSiA0lk6IUePnELvzLSch+U+lB44pmffUULxho7cstr32fRmp yyx1I+uF0AnCbCfOeFuhbpm9M+MKLg3C4I0HuLxBmbbEeVApWLWZDZ8PL8JKHyf52K 13KvbCwD6QqP5tZR/5f610cJ4pLH1mRtE2vw0WUp2+pvQuWZgzCXbomISIxP/sd/u7 cA0w22qS71+/mFkQ6qgxcoQVSCrPm+fOwAuiNHV/Ve2xDcRtJT8qpXrdm/z12eKFGR T3pJWBfjoN+FX3vOSg9dJ8gqXIA00bDqrxNK+2LL6Y+7FuE0di03m3j7FiuY4jVvTT CFcEQmkiCs0/A== Received: from localhost.localdomain (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4QC4Yp2nzCz11jJ; Thu, 4 May 2023 16:05:34 -0400 (EDT) From: Mathieu Desnoyers To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Subject: [RFC PATCH 11/13] netdevice.h: Fix parentheses around macro parameter use Date: Thu, 4 May 2023 16:05:25 -0400 Message-Id: <20230504200527.1935944-12-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> References: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add missing parentheses around macro parameter use in the following pattern: - "x - 1" changed for "(x) - 1", - "x->member" changed for "(x)->member". to ensure operator precedence behaves as expected. Remove useless parentheses around macro parameter use in the following pattern: - m((x), y) changed for m(x, y), because comma has the lowest operator precedence, which makes the extra comma useless. Signed-off-by: Mathieu Desnoyers Cc: Andrew Morton Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: netdev@vger.kernel.org --- include/linux/netdevice.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 08fbd4622ccf..5a357262a45b 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -283,7 +283,7 @@ struct hh_cache { /* cached hardware header; allow for machine alignment needs. */ #define HH_DATA_MOD 16 #define HH_DATA_OFF(__len) \ - (HH_DATA_MOD - (((__len - 1) & (HH_DATA_MOD - 1)) + 1)) + (HH_DATA_MOD - ((((__len) - 1) & (HH_DATA_MOD - 1)) + 1)) #define HH_DATA_ALIGN(__len) \ (((__len)+(HH_DATA_MOD-1))&~(HH_DATA_MOD - 1)) unsigned long hh_data[HH_DATA_ALIGN(LL_MAX_HEADER) / sizeof(long)]; @@ -4459,7 +4459,7 @@ static inline void netif_tx_unlock_bh(struct net_devi= ce *dev) } =20 #define HARD_TX_LOCK(dev, txq, cpu) { \ - if ((dev->features & NETIF_F_LLTX) =3D=3D 0) { \ + if (((dev)->features & NETIF_F_LLTX) =3D=3D 0) { \ __netif_tx_lock(txq, cpu); \ } else { \ __netif_tx_acquire(txq); \ @@ -4467,12 +4467,12 @@ static inline void netif_tx_unlock_bh(struct net_de= vice *dev) } =20 #define HARD_TX_TRYLOCK(dev, txq) \ - (((dev->features & NETIF_F_LLTX) =3D=3D 0) ? \ + ((((dev)->features & NETIF_F_LLTX) =3D=3D 0) ? \ __netif_tx_trylock(txq) : \ __netif_tx_acquire(txq)) =20 #define HARD_TX_UNLOCK(dev, txq) { \ - if ((dev->features & NETIF_F_LLTX) =3D=3D 0) { \ + if (((dev)->features & NETIF_F_LLTX) =3D=3D 0) { \ __netif_tx_unlock(txq); \ } else { \ __netif_tx_release(txq); \ @@ -4534,7 +4534,7 @@ static inline void netif_addr_unlock_bh(struct net_de= vice *dev) * rcu_read_lock held. */ #define for_each_dev_addr(dev, ha) \ - list_for_each_entry_rcu(ha, &dev->dev_addrs.list, list) + list_for_each_entry_rcu(ha, &(dev)->dev_addrs.list, list) =20 /* These functions live elsewhere (drivers/net/net_init.c, but related) */ =20 @@ -5237,6 +5237,6 @@ extern struct net_device *blackhole_netdev; /* Note: Avoid these macros in fast path, prefer per-cpu or per-queue coun= ters. */ #define DEV_STATS_INC(DEV, FIELD) atomic_long_inc(&(DEV)->stats.__##FIELD) #define DEV_STATS_ADD(DEV, FIELD, VAL) \ - atomic_long_add((VAL), &(DEV)->stats.__##FIELD) + atomic_long_add(VAL, &(DEV)->stats.__##FIELD) =20 #endif /* _LINUX_NETDEVICE_H */ --=20 2.25.1 From nobody Wed Feb 11 19:28:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C6D7C77B73 for ; Thu, 4 May 2023 21:02:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229758AbjEDVCt (ORCPT ); Thu, 4 May 2023 17:02:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230090AbjEDVCO (ORCPT ); Thu, 4 May 2023 17:02:14 -0400 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A2EE1734; Thu, 4 May 2023 14:01:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1683230734; bh=1jfyZJuK4k9g5CEpe8gCUedeSdOIfbCNOZJDVvTtWOk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tc4yMe+dNevzwFlfwp6HT3GKbEIZ6zDHUt7WxxxM2l5wvdmhFhE9c2ghavf7lfuXS yUOE9TorFjIilwout/zxZzthJA7GU5yXGedxPlWJ74oWHfbnpweJw+vaj+pn/56sDb KH+wazgLGkoJ6Bg/zeJ3vxNWomkPYz6NRNSMYWI5B1Kdo8/SUQmylzqb9EmiiuxKak Sq8X+1DXrgbHEkZ7qYTavuig7dN1ZoNTYXWb14q1N8jptcqJRQL0IFUP4+a5u/TXdw uPh0Bi7AIGDnVvnBt+jv2S25RvMgLq99tCBREknHhixsLetxD70RhzKQhrelXcsDQE Z535jfxloZg1w== Received: from localhost.localdomain (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4QC4Yp4cDXz11wl; Thu, 4 May 2023 16:05:34 -0400 (EDT) From: Mathieu Desnoyers To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Jens Axboe , linux-block@vger.kernel.org Subject: [RFC PATCH 12/13] blk-mq.h: Fix parentheses around macro parameter use Date: Thu, 4 May 2023 16:05:26 -0400 Message-Id: <20230504200527.1935944-13-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> References: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Fix the following macro parameter usage patterns in blk-mq.h for consistency, ensuring that operator precedence is respected: Added parentheses: - x->member is changed for (x)->member, - x.member is changed for (x).member, - flags >> BLK_MQ_F_ALLOC_POLICY_START_BIT is changed for (flags) >> BLK_MQ_F_ALLOC_POLICY_START_BIT. - "x =3D y" is changed for "x =3D (y)", because "y" can be an expression containing a comma if it is the result of the expansion of a macro such as #define eval(...) __VA_ARGS__, which would cause unexpected operator precedence. This use-case is far-fetched, but we have to choose one way or the other (with or without parentheses) for consistency. Removed parentheses: - m((x)) is changed for m(x) (the extra parentheses are useless), - m(x, (y), (z)) is changed for m(x, y, z), because comma is the lowest priority operator, and thus the extra parentheses are useless, - v[(x)] is changed for v[x], because the extra parentheses are useless given that [] already surrounds an expression, - "(i) =3D 0" is changed for "i =3D 0", because "i" is an lvalue, which makes the extra parentheses useless. Signed-off-by: Mathieu Desnoyers Cc: Andrew Morton Cc: Jens Axboe Cc: linux-block@vger.kernel.org --- include/linux/blk-mq.h | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 06caacd77ed6..4de6ad92530c 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -223,13 +223,13 @@ static inline unsigned short req_get_ioprio(struct re= quest *req) =20 #define rq_list_add(listptr, rq) do { \ (rq)->rq_next =3D *(listptr); \ - *(listptr) =3D rq; \ + *(listptr) =3D (rq); \ } while (0) =20 #define rq_list_add_tail(lastpptr, rq) do { \ (rq)->rq_next =3D NULL; \ - **(lastpptr) =3D rq; \ - *(lastpptr) =3D &rq->rq_next; \ + **(lastpptr) =3D (rq); \ + *(lastpptr) =3D &(rq)->rq_next; \ } while (0) =20 #define rq_list_pop(listptr) \ @@ -251,11 +251,11 @@ static inline unsigned short req_get_ioprio(struct re= quest *req) }) =20 #define rq_list_for_each(listptr, pos) \ - for (pos =3D rq_list_peek((listptr)); pos; pos =3D rq_list_next(pos)) + for (pos =3D rq_list_peek(listptr); pos; pos =3D rq_list_next(pos)) =20 #define rq_list_for_each_safe(listptr, pos, nxt) \ - for (pos =3D rq_list_peek((listptr)), nxt =3D rq_list_next(pos); \ - pos; pos =3D nxt, nxt =3D pos ? rq_list_next(pos) : NULL) + for (pos =3D rq_list_peek(listptr), nxt =3D rq_list_next(pos); \ + pos; pos =3D (nxt), nxt =3D (pos) ? rq_list_next(pos) : NULL) =20 #define rq_list_next(rq) (rq)->rq_next #define rq_list_empty(list) ((list) =3D=3D (struct request *) NULL) @@ -692,10 +692,10 @@ enum { BLK_MQ_CPU_WORK_BATCH =3D 8, }; #define BLK_MQ_FLAG_TO_ALLOC_POLICY(flags) \ - ((flags >> BLK_MQ_F_ALLOC_POLICY_START_BIT) & \ + (((flags) >> BLK_MQ_F_ALLOC_POLICY_START_BIT) & \ ((1 << BLK_MQ_F_ALLOC_POLICY_BITS) - 1)) #define BLK_ALLOC_POLICY_TO_MQ_FLAG(policy) \ - ((policy & ((1 << BLK_MQ_F_ALLOC_POLICY_BITS) - 1)) \ + (((policy) & ((1 << BLK_MQ_F_ALLOC_POLICY_BITS) - 1)) \ << BLK_MQ_F_ALLOC_POLICY_START_BIT) =20 #define BLK_MQ_NO_HCTX_IDX (-1U) @@ -948,11 +948,11 @@ static inline void *blk_mq_rq_to_pdu(struct request *= rq) } =20 #define queue_for_each_hw_ctx(q, hctx, i) \ - xa_for_each(&(q)->hctx_table, (i), (hctx)) + xa_for_each(&(q)->hctx_table, i, hctx) =20 #define hctx_for_each_ctx(hctx, ctx, i) \ - for ((i) =3D 0; (i) < (hctx)->nr_ctx && \ - ({ ctx =3D (hctx)->ctxs[(i)]; 1; }); (i)++) + for (i =3D 0; (i) < (hctx)->nr_ctx && \ + ({ ctx =3D (hctx)->ctxs[i]; 1; }); (i)++) =20 static inline void blk_mq_cleanup_rq(struct request *rq) { @@ -1013,20 +1013,20 @@ struct req_iterator { }; =20 #define __rq_for_each_bio(_bio, rq) \ - if ((rq->bio)) \ - for (_bio =3D (rq)->bio; _bio; _bio =3D _bio->bi_next) + if ((rq)->bio) \ + for (_bio =3D (rq)->bio; _bio; _bio =3D (_bio)->bi_next) =20 #define rq_for_each_segment(bvl, _rq, _iter) \ - __rq_for_each_bio(_iter.bio, _rq) \ - bio_for_each_segment(bvl, _iter.bio, _iter.iter) + __rq_for_each_bio((_iter).bio, _rq) \ + bio_for_each_segment(bvl, (_iter).bio, (_iter).iter) =20 #define rq_for_each_bvec(bvl, _rq, _iter) \ - __rq_for_each_bio(_iter.bio, _rq) \ - bio_for_each_bvec(bvl, _iter.bio, _iter.iter) + __rq_for_each_bio((_iter).bio, _rq) \ + bio_for_each_bvec(bvl, (_iter).bio, (_iter).iter) =20 #define rq_iter_last(bvec, _iter) \ - (_iter.bio->bi_next =3D=3D NULL && \ - bio_iter_last(bvec, _iter.iter)) + ((_iter).bio->bi_next =3D=3D NULL && \ + bio_iter_last(bvec, (_iter).iter)) =20 /* * blk_rq_pos() : the current sector --=20 2.25.1 From nobody Wed Feb 11 19:28:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5E70C7EE29 for ; Thu, 4 May 2023 20:32:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231514AbjEDUcf (ORCPT ); Thu, 4 May 2023 16:32:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229893AbjEDUcT (ORCPT ); Thu, 4 May 2023 16:32:19 -0400 Received: from smtpout.efficios.com (unknown [IPv6:2607:5300:203:b2ee::31e5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 094031156B; Thu, 4 May 2023 13:21:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1683230734; bh=QcIbf0/W/0tjmDJfN3K1x8lHrFbEPUWzJFa8s3c9fPA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=al4b3prNPOgFLIry5QRsiV7BMrgdJB5bp4bmx7Pos2w5P+YZsuggLjjbLG62RauMe RKuV7lps9ytKmdR7YJFSU0zi1AzzhbJ1BhCVHXCp3PLa+JCVK9SCFV+fHAcfb77EsW BMX3wqtdhQ2BybtmbZAHGLkMJv3aTFNUoeVukyGNmRl726XcDfprt7Hp5G+vXNzt2s xKJudcCUTE3Zcdr70kARY9RRTvDPV+H2pZtTIo48xW3VgUUEb3BoYJzqPcYJwPupZ+ AfsvwbTpjT0+oIZ4cEIvbxW3htx/Vux+3hxP18amRC5bEI/vi9t/3x9Y0ZAGlyZ/3b /RhxNuB7YQnkA== Received: from localhost.localdomain (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4QC4Yp64TWz11jK; Thu, 4 May 2023 16:05:34 -0400 (EDT) From: Mathieu Desnoyers To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Jens Axboe , Omar Sandoval , linux-block@vger.kernel.org Subject: [RFC PATCH 13/13] bio.h: Fix parentheses around macro parameter use Date: Thu, 4 May 2023 16:05:27 -0400 Message-Id: <20230504200527.1935944-14-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> References: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add missing parentheses around macro parameter use in the following patterns to ensure operator precedence behaves as expected: - "x++" is changed for "(x)++", - x->member is changed for (x)->member, - &x is changed for &(x). - "x =3D y" is changed for "x =3D (y)", because "y" can be an expression containing a comma if it is the result of the expansion of a macro such as #define eval(...) __VA_ARGS__, which would cause unexpected operator precedence. This use-case is far-fetched, but we have to choose one way or the other (with or without parentheses) for consistency. Remove useless parentheses in the following macro argument usage patterns: - m((x)) is changed for m(x), - m((x), y) is changed for m(x, y) because comma has lowest operator precedence, making the extra parentheses useless, Signed-off-by: Mathieu Desnoyers Cc: Jens Axboe Cc: Andrew Morton Cc: Omar Sandoval Cc: linux-block@vger.kernel.org --- include/linux/bio.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/include/linux/bio.h b/include/linux/bio.h index b3e7529ff55e..f09aea290511 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -20,7 +20,7 @@ static inline unsigned int bio_max_segs(unsigned int nr_s= egs) } =20 #define bio_prio(bio) (bio)->bi_ioprio -#define bio_set_prio(bio, prio) ((bio)->bi_ioprio =3D prio) +#define bio_set_prio(bio, prio) ((bio)->bi_ioprio =3D (prio)) =20 #define bio_iter_iovec(bio, iter) \ bvec_iter_bvec((bio)->bi_io_vec, (iter)) @@ -37,7 +37,7 @@ static inline unsigned int bio_max_segs(unsigned int nr_s= egs) #define bio_iovec(bio) bio_iter_iovec((bio), (bio)->bi_iter) =20 #define bvec_iter_sectors(iter) ((iter).bi_size >> 9) -#define bvec_iter_end_sector(iter) ((iter).bi_sector + bvec_iter_sectors((= iter))) +#define bvec_iter_end_sector(iter) ((iter).bi_sector + bvec_iter_sectors(i= ter)) =20 #define bio_sectors(bio) bvec_iter_sectors((bio)->bi_iter) #define bio_end_sector(bio) bvec_iter_end_sector((bio)->bi_iter) @@ -93,7 +93,7 @@ static inline bool bio_next_segment(const struct bio *bio, * before it got to the driver and the driver won't own all of it */ #define bio_for_each_segment_all(bvl, bio, iter) \ - for (bvl =3D bvec_init_iter_all(&iter); bio_next_segment((bio), &iter); ) + for (bvl =3D bvec_init_iter_all(&(iter)); bio_next_segment(bio, &(iter));= ) =20 static inline void bio_advance_iter(const struct bio *bio, struct bvec_iter *iter, unsigned int bytes) @@ -145,17 +145,17 @@ static inline void bio_advance(struct bio *bio, unsig= ned int nbytes) #define __bio_for_each_segment(bvl, bio, iter, start) \ for (iter =3D (start); \ (iter).bi_size && \ - ((bvl =3D bio_iter_iovec((bio), (iter))), 1); \ - bio_advance_iter_single((bio), &(iter), (bvl).bv_len)) + ((bvl =3D bio_iter_iovec(bio, iter)), 1); \ + bio_advance_iter_single(bio, &(iter), (bvl).bv_len)) =20 #define bio_for_each_segment(bvl, bio, iter) \ __bio_for_each_segment(bvl, bio, iter, (bio)->bi_iter) =20 -#define __bio_for_each_bvec(bvl, bio, iter, start) \ +#define __bio_for_each_bvec(bvl, bio, iter, start) \ for (iter =3D (start); \ (iter).bi_size && \ - ((bvl =3D mp_bvec_iter_bvec((bio)->bi_io_vec, (iter))), 1); \ - bio_advance_iter_single((bio), &(iter), (bvl).bv_len)) + ((bvl =3D mp_bvec_iter_bvec((bio)->bi_io_vec, iter)), 1); \ + bio_advance_iter_single(bio, &(iter), (bvl).bv_len)) =20 /* iterate over multi-page bvec */ #define bio_for_each_bvec(bvl, bio, iter) \ @@ -167,7 +167,7 @@ static inline void bio_advance(struct bio *bio, unsigne= d int nbytes) */ #define bio_for_each_bvec_all(bvl, bio, i) \ for (i =3D 0, bvl =3D bio_first_bvec_all(bio); \ - i < (bio)->bi_vcnt; i++, bvl++) + i < (bio)->bi_vcnt; (i)++, (bvl)++) =20 #define bio_iter_last(bvec, iter) ((iter).bi_size =3D=3D (bvec).bv_len) =20 @@ -548,7 +548,7 @@ static inline void bio_list_init(struct bio_list *bl) #define BIO_EMPTY_LIST { NULL, NULL } =20 #define bio_list_for_each(bio, bl) \ - for (bio =3D (bl)->head; bio; bio =3D bio->bi_next) + for (bio =3D (bl)->head; bio; bio =3D (bio)->bi_next) =20 static inline unsigned bio_list_size(const struct bio_list *bl) { @@ -702,7 +702,7 @@ static inline bool bioset_initialized(struct bio_set *b= s) =20 #define bio_for_each_integrity_vec(_bvl, _bio, _iter) \ for_each_bio(_bio) \ - bip_for_each_vec(_bvl, _bio->bi_integrity, _iter) + bip_for_each_vec(_bvl, (_bio)->bi_integrity, _iter) =20 extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp= _t, unsigned int); extern int bio_integrity_add_page(struct bio *, struct page *, unsigned in= t, unsigned int); --=20 2.25.1