History

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.

Rasmus Villemoes committed 12 years ago

Commit 7e5f97d1 parent c5341ec2 files · +6 −3Browse files

Showing the changes to include/linux/bitmap.h (1 of 2 files). Show all

Unified · Split

include/linux/bitmap.h+1−1
@@ -191,7 +191,7 @@ static inline int bitmap_and(unsigned long *dst, const unsigned long *src1, · 190 unmodified lines
191191 const unsigned long *src2, unsigned int nbits)
192192 {
193193 if (small_const_nbits(nbits))
194− return (*dst = *src1 & *src2) != 0;
194+ return (*dst = *src1 & *src2 & BITMAP_LAST_WORD_MASK(nbits)) != 0;
195195 return __bitmap_and(dst, src1, src2, nbits);
196196 }
197197

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t