mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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:
parent
4ef7374618
commit
58f91ead4b
1 changed files with 3 additions and 3 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue