提交 a09c94d0 编写于 作者: S Sven Eckelmann 提交者: Simon Wunderlich

batman-adv: Fix possible side-effects in _batadv_dbg

An argument of a macro should not be evaluated multiple times. Otherwise
embedded operations in these arguments will be executed multiple times.
Signed-off-by: NSven Eckelmann <sven@narfation.org>
Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
上级 1fda4c0a
...@@ -73,9 +73,10 @@ __printf(2, 3); ...@@ -73,9 +73,10 @@ __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) && \ struct batadv_priv *__batpriv = (bat_priv); \
if (atomic_read(&__batpriv->log_level) & (type) && \
(!(ratelimited) || net_ratelimit())) \ (!(ratelimited) || net_ratelimit())) \
batadv_debug_log(bat_priv, fmt, ## arg); \ batadv_debug_log(__batpriv, fmt, ## arg); \
} \ } \
while (0) while (0)
#else /* !CONFIG_BATMAN_ADV_DEBUG */ #else /* !CONFIG_BATMAN_ADV_DEBUG */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册