Re: [PATCH v10 1/4] bitops: Introduce the for_each_set_clump macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Oct 3, 2020 at 3:56 PM William Breathitt Gray
<vilhelm.gray@xxxxxxxxx> wrote:
> On Sat, Oct 03, 2020 at 03:45:04PM +0300, Andy Shevchenko wrote:
> > On Sat, Oct 3, 2020 at 2:37 PM Syed Nayyar Waris <syednwaris@xxxxxxxxx> wrote:
> > > On Sat, Oct 3, 2020 at 2:14 PM Andy Shevchenko
> > > <andy.shevchenko@xxxxxxxxx> wrote:
> > > > On Sat, Oct 3, 2020 at 2:51 AM Syed Nayyar Waris <syednwaris@xxxxxxxxx> wrote:

...

> > > > > +               map[index] &= ~BITMAP_FIRST_WORD_MASK(start);
> > > > > +               map[index] |= value << offset;
> >
> > Side note: I would prefer + 0 here and there, but it's up to you.
> >
> > > > > +               map[index + 1] &= ~BITMAP_LAST_WORD_MASK(start + nbits);
> > > > > +               map[index + 1] |= (value >> space);
> >
> > By the way, what about this in the case of start=0, nbits > 64?
> > space == 64 -> UB.
> >
> > (And btw parentheses are redundant here)
>
> I think this is the same situation as before: we should document that
> nbits must be between 1 and BITS_PER_LONG.

At least documented, yes.

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux