[ovs-dev] bitmap_allocate1(size_t n_bits) will fail when (n_bits % BITMAP_ULONG_BITS == 0)

Ben Pfaff blp at nicira.com
Sat Jun 29 03:59:37 UTC 2013


On Sat, Jun 29, 2013 at 10:14:16AM +0800, ZhengLingyun wrote:
> /* Ensure that the last "unsigned long" in the bitmap only has as many
>      * 1-bits as there actually should be. */
> bitmap[n_longs - 1] = (1UL << (n_bits % BITMAP_ULONG_BITS)) - 1;
> from bitmap_allocate1(),
> It will fail when n_bits % BITMAP_ULONG_BITS == 0, does it matter?

I agree that this is a bug.  We should fix it.

The actual consequences don't seem too bad.  There is only one user of
bitmap_allocate1().



More information about the dev mailing list