[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <201106150858.04851.sven@narfation.org>
Date: Wed, 15 Jun 2011 08:58:02 +0200
From: Sven Eckelmann <sven@...fation.org>
To: David Howells <dhowells@...hat.com>
Cc: Marek Lindner <lindner_marek@...oo.de>,
Simon Wunderlich <siwu@....tu-chemnitz.de>,
b.a.t.m.a.n@...ts.open-mesh.org, netdev@...r.kernel.org
Subject: Re: [PATCH 1/2] batman-adv: count_real_packets() in batman-adv assumes char is signed
On Wednesday 15 June 2011 01:51:32 David Howells wrote:
> count_real_packets() in batman-adv assumes char is signed, and returns -1
> through it:
>
> net/batman-adv/routing.c: In function 'receive_bat_packet':
> net/batman-adv/routing.c:739: warning: comparison is always false due to
> limited range of data type
>
> Use int instead.
>
> This is also looks a bit weird as (presumably signed) is_duplicate is
> constructed by OR'ding together the unsigned results of get_bit_status()
> (though the latter only returns 0 or 1).
Sry, had to catch the train and had no time to explain it further.
It is correct that is_duplicate will only have 0 and 1 stored, but the
window_protected function (called before the loop) may detect that the packet
has to be dropped and we return in that case -1.
I don't know who started to use char in those places, but thanks for reminding
me how much I hate it and that I wanted to check the rest of the code. :)
I will submit the corrected patch in a pull request later this week to David
S. Miller.
Thanks,
Sven
Download attachment "signature.asc " of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists