svn commit: r257862 - head/sys/ofed/include/linux

Alfred Perlstein alfred at FreeBSD.org
Fri Nov 8 18:20:20 UTC 2013


Author: alfred
Date: Fri Nov  8 18:20:19 2013
New Revision: 257862
URL: http://svnweb.freebsd.org/changeset/base/257862

Log:
  Use explicit long cast to avoid overflow in bitopts.
  
  This was causing problems with the buddy allocator inside of
  ofed.
  
  Submitted by: odeds

Modified:
  head/sys/ofed/include/linux/bitops.h

Modified: head/sys/ofed/include/linux/bitops.h
==============================================================================
--- head/sys/ofed/include/linux/bitops.h	Fri Nov  8 17:27:38 2013	(r257861)
+++ head/sys/ofed/include/linux/bitops.h	Fri Nov  8 18:20:19 2013	(r257862)
@@ -286,14 +286,14 @@ bitmap_empty(unsigned long *addr, int si
 #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)


More information about the svn-src-head mailing list