diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2019-12-06 12:51:54 -0800 |
|---|---|---|
| committer | Linux Build Service Account <lnxbuild@localhost> | 2019-12-06 12:51:54 -0800 |
| commit | 33dc678e7692f04ecc1eeddeb1cca8a809bc1727 (patch) | |
| tree | 7ac214cbb1f5256e0738cd6423f01e364b942bd4 /include/linux/bitmap.h | |
| parent | feb565e67fc2b2f2a95890577120141be5886594 (diff) | |
| parent | 72078891843ce0d5b8e95040d09ba92913916af9 (diff) | |
Merge 72078891843ce0d5b8e95040d09ba92913916af9 on remote branch
Change-Id: I219a5f0e8bd6ee3be3ba0d49230dde908d35dc25
Diffstat (limited to 'include/linux/bitmap.h')
| -rw-r--r-- | include/linux/bitmap.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index 9653fdb76a42..714ce4a5e31f 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h @@ -175,8 +175,13 @@ extern int bitmap_print_to_pagebuf(bool list, char *buf, #define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) & (BITS_PER_LONG - 1))) #define BITMAP_LAST_WORD_MASK(nbits) (~0UL >> (-(nbits) & (BITS_PER_LONG - 1))) +/* + * The static inlines below do not handle constant nbits==0 correctly, + * so make such users (should any ever turn up) call the out-of-line + * versions. + */ #define small_const_nbits(nbits) \ - (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG) + (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG && (nbits) > 0) static inline void bitmap_zero(unsigned long *dst, unsigned int nbits) { @@ -303,7 +308,7 @@ static __always_inline int bitmap_weight(const unsigned long *src, unsigned int } static inline void bitmap_shift_right(unsigned long *dst, const unsigned long *src, - unsigned int shift, int nbits) + unsigned int shift, unsigned int nbits) { if (small_const_nbits(nbits)) *dst = (*src & BITMAP_LAST_WORD_MASK(nbits)) >> shift; |
