lkml.org 
[lkml]   [2018]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] linux/bitmap.h: fix BITMAP_LAST_WORD_MASK
On 07/26/2018 04:48 PM, Andy Shevchenko wrote:
> On Thu, Jul 26, 2018 at 11:07 AM, Wei Wang <wei.w.wang@intel.com> wrote:
>> The existing BITMAP_LAST_WORD_MASK macro returns 0xffffffff if nbits is
>> 0. This patch changes the macro to return 0 when there is no bit needs to
>> be masked.
>>
> Can you provide a practical example of what's going wrong before this
> patch applied?
>

The reason of making this patch is that I saw some other software which
ports this function and has possibilities to fall into bugs with usages
which pass 0 to the macro. So I wonder if it would be necessary to make
such changes in case we would get a similar bug. Or adding something to
explain that "0" is not applicable to this macro as a reminder to people
who would use it.

Best,
Wei

\
 
 \ /
  Last update: 2018-07-26 12:04    [W:0.074 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site