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