Return-Path: Date: Tue, 25 Dec 2012 13:37:53 -0800 (PST) Message-Id: <20121225.133753.1383155065923849678.davem@davemloft.net> From: David Miller In-Reply-To: References: <1356315256-6572-20-git-send-email-akinobu.mita@gmail.com> <20121225112657.GC2604@ritirata.org> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [B.A.T.M.A.N.] [PATCH 19/29] batman-adv: fix random jitter calculation Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: akinobu.mita@gmail.com Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, linux-kernel@vger.kernel.org, siwu@hrz.tu-chemnitz.de, akpm@linux-foundation.org, lindner_marek@yahoo.de 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@lists.open-mesh.org >>> Cc: "David S. Miller" >>> Cc: netdev@vger.kernel.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.