Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4425rwr; Thu, 4 May 2023 13:55:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6YIc1tfYEN+Fmv96gncvceF5qxfgLSOCD1oXOJZBEgHzCbwdIKAtgSBj72iVRMZ6zTum5i X-Received: by 2002:a17:902:aa49:b0:19c:f096:bbef with SMTP id c9-20020a170902aa4900b0019cf096bbefmr4494029plr.49.1683233728395; Thu, 04 May 2023 13:55:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683233728; cv=none; d=google.com; s=arc-20160816; b=WCSm6TrcqXPk1OTkyEc0WejWEiS7F27hmPn7Ib2QnWdBEJsCI0vzOQK+cPfpOvdhzz SR22u10OgkI9YNx7sZz5p0/743L2JFmUQaPtow6ZTK/5rjJW15WbaegpIAugj4xyTJLI vu+fuuahyI+4P7LfEmmwl08ExtOVQJo8y395eWN6Lp6D98E75a0wSwWSBx+snzFPd/mW BEV4NBZEkyHEKt0D4WbNLn5tDl3xv6Efwg7btJiclCYs4visyrqgP0Ce1YdgrYyJBN+h 8nS13XflvD/mwVt0texl0JrITjs0xC85GbwLLlQ9rHwaUJ6Nl7j6DIMGF+fxq1+oFR3k Qqpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LM+3H8dLN0nAcKQLW+3LBfFpWVETNu8c+RfxD3XsFAQ=; b=MTQC+Npp9AA2S7Uvo72Ta/KjKuJsYuHgSwz9EstOJlI89pp1jE3nwRUxmcH5OembxQ Fl9S9yDT2RPxt6xU8PBvQ0RJG+QNRrCCjNsRjYT9PB8Yk+7MVvgoXhjwfRII49vOM1Xi 1+vFZiC5uLrh/C8AbaRXL19EmbRDiGPv6XT5bLIipXQHxA7pGOPYKsxtlsRweNhw3Bya KZzdQYlZEiMz0qO5HiQx8TGPujcmr9i1GaCTsqtivYxDnIV1nuc1GxX88sxQcKrHKhf6 TX0IBiW9q5NczT36vVv/dDy+0n1n67qDUb9w+XodI8/ufgfEF/cEbRXnEgCpm6adCdMc twVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=toqxukN7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f15-20020a170902684f00b001aae619fa18si11291684pln.476.2023.05.04.13.55.15; Thu, 04 May 2023 13:55:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=toqxukN7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229609AbjEDUwO (ORCPT + 99 others); Thu, 4 May 2023 16:52:14 -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: 8bit X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RDNS_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)", 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_head *b) */ #define hlist_bl_for_each_entry(tpos, pos, head, member) \ for (pos = hlist_bl_first(head); \ - pos && \ - ({ tpos = hlist_bl_entry(pos, typeof(*tpos), member); 1;}); \ - pos = pos->next) + (pos) && \ + ({ tpos = hlist_bl_entry(pos, typeof(*(tpos)), member); 1;}); \ + pos = (pos)->next) /** * hlist_bl_for_each_entry_safe - iterate over list of given type safe against removal of list entry @@ -182,8 +182,8 @@ static inline bool hlist_bl_is_locked(struct hlist_bl_head *b) */ #define hlist_bl_for_each_entry_safe(tpos, pos, n, head, member) \ for (pos = hlist_bl_first(head); \ - pos && ({ n = pos->next; 1; }) && \ - ({ tpos = hlist_bl_entry(pos, typeof(*tpos), member); 1;}); \ - pos = n) + (pos) && ({ n = (pos)->next; 1; }) && \ + ({ tpos = hlist_bl_entry(pos, typeof(*(tpos)), member); 1;}); \ + pos = (n)) #endif -- 2.25.1