svn commit: r282741 - head/sys/ofed/include/linux
Mark Johnston
markj at FreeBSD.org
Sun May 10 22:04:43 UTC 2015
Author: markj
Date: Sun May 10 22:04:42 2015
New Revision: 282741
URL: https://svnweb.freebsd.org/changeset/base/282741
Log:
find_next_bit() and find_next_zero_bit(): if the caller-specified offset
lies within the last block of the bit set and no bits are set beyond the
offset, terminate the search immediately instead of continuing as though
there are further blocks in the set and subsequently returning an incorrect
result.
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
Modified:
head/sys/ofed/include/linux/bitops.h
Modified: head/sys/ofed/include/linux/bitops.h
==============================================================================
--- head/sys/ofed/include/linux/bitops.h Sun May 10 22:03:59 2015 (r282740)
+++ head/sys/ofed/include/linux/bitops.h Sun May 10 22:04:42 2015 (r282741)
@@ -165,6 +165,8 @@ find_next_bit(unsigned long *addr, unsig
mask = (*addr) & ~BIT_MASK(offs);
if (mask)
return (bit + __ffsl(mask));
+ if (size - bit <= BITS_PER_LONG)
+ return (size);
bit += BITS_PER_LONG;
addr++;
}
@@ -203,6 +205,8 @@ find_next_zero_bit(unsigned long *addr,
mask = ~(*addr) & ~BIT_MASK(offs);
if (mask)
return (bit + __ffsl(mask));
+ if (size - bit <= BITS_PER_LONG)
+ return (size);
bit += BITS_PER_LONG;
addr++;
}
More information about the svn-src-all
mailing list