Commit 4c7da0f6 authored by Sven Eckelmann's avatar Sven Eckelmann Committed by Simon Wunderlich

batman-adv: Avoid precedence issues in macros

It must be avoided that arguments to a macro are evaluated ungrouped (which
enforces normal operator precendence). Otherwise the result of the macro
is not well defined.
Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
Signed-off-by: default avatarSimon Wunderlich <sw@simonwunderlich.de>
parent 507b37cf
...@@ -73,9 +73,9 @@ __printf(2, 3); ...@@ -73,9 +73,9 @@ __printf(2, 3);
/* possibly ratelimited debug output */ /* possibly ratelimited debug output */
#define _batadv_dbg(type, bat_priv, ratelimited, fmt, arg...) \ #define _batadv_dbg(type, bat_priv, ratelimited, fmt, arg...) \
do { \ do { \
if (atomic_read(&bat_priv->log_level) & type && \ if (atomic_read(&(bat_priv)->log_level) & (type) && \
(!ratelimited || net_ratelimit())) \ (!(ratelimited) || net_ratelimit())) \
batadv_debug_log(bat_priv, fmt, ## arg);\ batadv_debug_log(bat_priv, fmt, ## arg); \
} \ } \
while (0) while (0)
#else /* !CONFIG_BATMAN_ADV_DEBUG */ #else /* !CONFIG_BATMAN_ADV_DEBUG */
......
...@@ -199,8 +199,8 @@ struct packet_type; ...@@ -199,8 +199,8 @@ struct packet_type;
struct seq_file; struct seq_file;
struct sk_buff; struct sk_buff;
#define BATADV_PRINT_VID(vid) ((vid & BATADV_VLAN_HAS_TAG) ? \ #define BATADV_PRINT_VID(vid) (((vid) & BATADV_VLAN_HAS_TAG) ? \
(int)(vid & VLAN_VID_MASK) : -1) (int)((vid) & VLAN_VID_MASK) : -1)
extern struct list_head batadv_hardif_list; extern struct list_head batadv_hardif_list;
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <linux/types.h> #include <linux/types.h>
#define batadv_tp_is_error(n) ((u8)n > 127 ? 1 : 0) #define batadv_tp_is_error(n) ((u8)(n) > 127 ? 1 : 0)
/** /**
* enum batadv_packettype - types for batman-adv encapsulated packets * enum batadv_packettype - types for batman-adv encapsulated packets
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment