Use explicit long cast to avoid overflow in bitopts.

This was causing problems with the buddy allocator inside of
ofed.

Submitted by: odeds
This commit is contained in:
Alfred Perlstein 2013-11-08 18:20:19 +00:00
parent 4ef7374618
commit 58f91ead4b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=257862

View File

@ -286,14 +286,14 @@ bitmap_empty(unsigned long *addr, int size)
#define NBLONG (NBBY * sizeof(long))
#define set_bit(i, a) \
atomic_set_long(&((volatile long *)(a))[(i)/NBLONG], 1 << (i) % NBLONG)
atomic_set_long(&((volatile long *)(a))[(i)/NBLONG], 1UL << (i) % NBLONG)
#define clear_bit(i, a) \
atomic_clear_long(&((volatile long *)(a))[(i)/NBLONG], 1 << (i) % NBLONG)
atomic_clear_long(&((volatile long *)(a))[(i)/NBLONG], 1UL << (i) % NBLONG)
#define test_bit(i, a) \
!!(atomic_load_acq_long(&((volatile long *)(a))[(i)/NBLONG]) & \
1 << ((i) % NBLONG))
1UL << ((i) % NBLONG))
static inline long
test_and_clear_bit(long bit, long *var)