* [PATCH] netlink: Remove extra brackets of nla_for_each_attr()
@ 2021-09-16 2:07 Jiasheng Jiang
2021-09-16 2:50 ` Stephen Hemminger
0 siblings, 1 reply; 2+ messages in thread
From: Jiasheng Jiang @ 2021-09-16 2:07 UTC (permalink / raw)
To: davem, kuba; +Cc: netdev, linux-kernel, Jiasheng Jiang
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
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] netlink: Remove extra brackets of nla_for_each_attr()
2021-09-16 2:07 [PATCH] netlink: Remove extra brackets of nla_for_each_attr() Jiasheng Jiang
@ 2021-09-16 2:50 ` Stephen Hemminger
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2021-09-16 2:50 UTC (permalink / raw)
To: Jiasheng Jiang; +Cc: davem, kuba, netdev, linux-kernel
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-09-16 2:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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).