From: Sven Eckelmann Date: Wed, 22 Feb 2017 16:16:41 +0000 (+0100) Subject: batman-adv: Fix possible side-effects in _batadv_dbg X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a09c94d07becd85b5be57074fd4553e197ce97a4;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Simon Wunderlich --- 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 */