summaryrefslogtreecommitdiffstats
path: root/net/batman-adv
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2017-02-22 17:16:41 +0100
committerSimon Wunderlich <sw@simonwunderlich.de>2017-03-16 21:14:52 +0100
commita09c94d07becd85b5be57074fd4553e197ce97a4 (patch)
treeddbd5d74770ca9778e3f7e9b4cdca5dc7467dd9d /net/batman-adv
parent1fda4c0ac00353beceb33b524888c3b71432b6d6 (diff)
downloadlinux-stable-a09c94d07becd85b5be57074fd4553e197ce97a4.tar.gz
linux-stable-a09c94d07becd85b5be57074fd4553e197ce97a4.tar.bz2
linux-stable-a09c94d07becd85b5be57074fd4553e197ce97a4.zip
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: Sven Eckelmann <sven@narfation.org> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Diffstat (limited to 'net/batman-adv')
-rw-r--r--net/batman-adv/log.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/batman-adv/log.h b/net/batman-adv/log.h
index 7a2b9f4da078..65ce97efa6b5 100644
--- a/net/batman-adv/log.h
+++ b/net/batman-adv/log.h
@@ -73,9 +73,10 @@ __printf(2, 3);
/* possibly ratelimited debug output */
#define _batadv_dbg(type, bat_priv, ratelimited, fmt, arg...) \
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())) \
- batadv_debug_log(bat_priv, fmt, ## arg); \
+ batadv_debug_log(__batpriv, fmt, ## arg); \
} \
while (0)
#else /* !CONFIG_BATMAN_ADV_DEBUG */