linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Cc: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] netlink: Remove extra brackets of nla_for_each_attr()
Date: Wed, 15 Sep 2021 19:50:34 -0700	[thread overview]
Message-ID: <20210915195034.280bd610@hermes.local> (raw)
In-Reply-To: <1631758028-3805500-1-git-send-email-jiasheng@iscas.ac.cn>

On Thu, 16 Sep 2021 02:07:08 +0000
Jiasheng Jiang <jiasheng@iscas.ac.cn> wrote:

> It's obvious that '&(rem)' has unneeded brackets.
> Therefore it's better to remove them.
> 
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
>  include/net/netlink.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/net/netlink.h b/include/net/netlink.h
> index 1ceec51..5822e0d 100644
> --- a/include/net/netlink.h
> +++ b/include/net/netlink.h
> @@ -1920,7 +1920,7 @@ static inline int nla_total_size_64bit(int payload)
>  #define nla_for_each_attr(pos, head, len, rem) \
>  	for (pos = head, rem = len; \
>  	     nla_ok(pos, rem); \
> -	     pos = nla_next(pos, &(rem)))
> +	     pos = nla_next(pos, &rem))
>  
>  /**
>   * nla_for_each_nested - iterate over nested attributes

No.

nla_for_each_attr is a macro and in a macro, there should be
added parenthesis around any use of macro argument to prevent
unintended side effects.

      reply	other threads:[~2021-09-16  2:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-16  2:07 [PATCH] netlink: Remove extra brackets of nla_for_each_attr() Jiasheng Jiang
2021-09-16  2:50 ` Stephen Hemminger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210915195034.280bd610@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=davem@davemloft.net \
    --cc=jiasheng@iscas.ac.cn \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).