diff mbox series

netlink: Remove extra brackets of nla_for_each_attr()

Message ID 1631758028-3805500-1-git-send-email-jiasheng@iscas.ac.cn (mailing list archive)
State Rejected
Delegated to: Netdev Maintainers
Headers show
Series netlink: Remove extra brackets of nla_for_each_attr() | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers success CCed 3 of 3 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 3450 this patch: 3450
netdev/kdoc success Errors and warnings before: 14 this patch: 14
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 3498 this patch: 3498
netdev/header_inline success Link

Commit Message

Jiasheng Jiang Sept. 16, 2021, 2:07 a.m. UTC
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(-)

Comments

Stephen Hemminger Sept. 16, 2021, 2:50 a.m. UTC | #1
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.
diff mbox series

Patch

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