From 58f91ead4b032ec29b053af848a4ec0d648fdd6d Mon Sep 17 00:00:00 2001 From: Alfred Perlstein Date: Fri, 8 Nov 2013 18:20:19 +0000 Subject: [PATCH] Use explicit long cast to avoid overflow in bitopts. This was causing problems with the buddy allocator inside of ofed. Submitted by: odeds --- sys/ofed/include/linux/bitops.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/ofed/include/linux/bitops.h b/sys/ofed/include/linux/bitops.h index 4ada7089b989..bac688af5e72 100644 --- a/sys/ofed/include/linux/bitops.h +++ b/sys/ofed/include/linux/bitops.h @@ -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)