diff options
| author | Rasmus Villemoes <linux@rasmusvillemoes.dk> | 2014-08-06 16:10:22 -0700 |
|---|---|---|
| committer | Mister Oyster <oysterized@gmail.com> | 2017-04-11 10:59:32 +0200 |
| commit | 3056cb60d5b703ab78a66afe32fc571508952e23 (patch) | |
| tree | f5f1c923bf0a57a2eb6508091ee61d11babfbde0 /include | |
| parent | f28752989c4d7a076a2414cd6eaab8083fd1ea10 (diff) | |
lib: bitmap: add missing mask in bitmap_and
Apparently, bitmap_and is supposed to return whether the new bitmap is
empty. But it didn't take potential garbage bits in the last word into
account.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/bitmap.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index 0d128516e..45dc7aa45 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h @@ -205,7 +205,7 @@ static inline int bitmap_and(unsigned long *dst, const unsigned long *src1, const unsigned long *src2, unsigned int nbits) { if (small_const_nbits(nbits)) - return (*dst = *src1 & *src2) != 0; + return (*dst = *src1 & *src2 & BITMAP_LAST_WORD_MASK(nbits)) != 0; return __bitmap_and(dst, src1, src2, nbits); } |
