From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH 19/29] batman-adv: fix random jitter calculation Date: Tue, 25 Dec 2012 13:37:53 -0800 (PST) Message-ID: <20121225.133753.1383155065923849678.davem@davemloft.net> References: <1356315256-6572-20-git-send-email-akinobu.mita@gmail.com> <20121225112657.GC2604@ritirata.org> Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, siwu-MaAgPAbsBIVS8oHt8HbXEIQuADTiUCJX@public.gmane.org, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org, lindner_marek-LWAfsSFWpa4@public.gmane.org To: akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: b.a.t.m.a.n-bounces-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org Sender: "B.A.T.M.A.N" List-Id: netdev.vger.kernel.org From: Akinobu Mita Date: Wed, 26 Dec 2012 06:35:37 +0900 > 2012/12/25 Antonio Quartulli : >> On Mon, Dec 24, 2012 at 11:14:06AM +0900, Akinobu Mita wrote: >>> batadv_iv_ogm_emit_send_time() attempts to calculates a random integer >>> in the range of 'orig_interval +- BATADV_JITTER' by the below lines. >>> >>> msecs = atomic_read(&bat_priv->orig_interval) - BATADV_JITTER; >>> msecs += (random32() % 2 * BATADV_JITTER); >>> >>> But it actually gets 'orig_interval' or 'orig_interval - BATADV_JITTER' >>> because '%' and '*' have same precedence and associativity is >>> left-to-right. >>> >>> This adds the parentheses at the appropriate position so that it matches >>> original intension. >>> >>> Signed-off-by: Akinobu Mita >>> Cc: Marek Lindner >>> Cc: Simon Wunderlich >>> Cc: Antonio Quartulli >>> Cc: b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org >>> Cc: "David S. Miller" >>> Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org >>> --- >> >> Acked-by: Antonio Quartulli >> >> But I would suggest to apply this change to net, since it is a fix. > > I agree. > David, please consider to apply this patch for 3.8-rc*. > All patches I should consider seriously should be properly reposted for review and inclusion.