On 8/26/2016 12:49 AM, Christophe JAILLET wrote:I agree with you...
The 2nd parameter of 'find_first_bit' is the number of bits to search.If the size can be 4 or 8, then using 64 universally is not correct.
In this case, we are passing 'sizeof(unsigned long)' which is likely to
be 4 or 8.
Why not use sizeof() * 8 (or << 3)?
... as noted here
It is likely that the number of bits of 'port_mask' was expected here. This
variable is a 'u64', so use 64 instead.
It has been spotted by the following coccinelle script:
@@
expression ret, x;
@@
* ret = \(find_first_bit \| find_first_zero_bit\) (x, sizeof(...));
Signed-off-by: Christophe JAILLET <christophe.jaillet-39ZsbGIQGT5GWvitb5QawA@xxxxxxxxxxxxxxxx>
---
Not sure that using 64 directly is the best option.
Maybe '8 * sizeof(port_mask)' as used in the same file for
'for_each_set_bit' would be better
---