Re: [PATCH v2] bitfield: fix *_encode_bits()

2018-06-15 Thread Andy Shevchenko
On Fri, Jun 15, 2018 at 12:30 PM, Johannes Berg wrote: > On Fri, 2018-06-15 at 11:51 +0300, Andy Shevchenko wrote: >> On Fri, Jun 15, 2018 at 12:26 AM, Johannes Berg >> wrote: >> > There's a bug in *_encode_bits() in using ~field_multiplier() for >> > the check whether or not the constant value f

Re: [PATCH v2] bitfield: fix *_encode_bits()

2018-06-15 Thread Johannes Berg
On Fri, 2018-06-15 at 11:51 +0300, Andy Shevchenko wrote: > On Fri, Jun 15, 2018 at 12:26 AM, Johannes Berg > wrote: > > There's a bug in *_encode_bits() in using ~field_multiplier() for > > the check whether or not the constant value fits into the field, > > this is wrong and clearly ~field_mask(

Re: [PATCH v2] bitfield: fix *_encode_bits()

2018-06-15 Thread Andy Shevchenko
On Fri, Jun 15, 2018 at 12:26 AM, Johannes Berg wrote: > There's a bug in *_encode_bits() in using ~field_multiplier() for > the check whether or not the constant value fits into the field, > this is wrong and clearly ~field_mask() was intended. This was > triggering for me for both constant and n

[PATCH v2] bitfield: fix *_encode_bits()

2018-06-14 Thread Johannes Berg
There's a bug in *_encode_bits() in using ~field_multiplier() for the check whether or not the constant value fits into the field, this is wrong and clearly ~field_mask() was intended. This was triggering for me for both constant and non-constant values. Additionally, make this case actually into