Date: Sun, 15 Jun 2014 18:32:03 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r267517 - stable/10/sys/ofed/include/linux Message-ID: <201406151832.s5FIW3cY086761@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Sun Jun 15 18:32:02 2014 New Revision: 267517 URL: http://svnweb.freebsd.org/changeset/base/267517 Log: MFC r267395: - Fix out of range shifting bug in bitops.h. - Make code a bit easier to read by adding parenthesis. Modified: stable/10/sys/ofed/include/linux/bitops.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/include/linux/bitops.h ============================================================================== --- stable/10/sys/ofed/include/linux/bitops.h Sun Jun 15 18:30:26 2014 (r267516) +++ stable/10/sys/ofed/include/linux/bitops.h Sun Jun 15 18:32:02 2014 (r267517) @@ -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], 1UL << (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], 1UL << (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]) & \ - 1UL << ((i) % NBLONG)) + (1UL << ((i) % NBLONG))) static inline long test_and_clear_bit(long bit, long *var) @@ -302,7 +302,7 @@ test_and_clear_bit(long bit, long *var) var += bit / (sizeof(long) * NBBY); bit %= sizeof(long) * NBBY; - bit = 1 << bit; + bit = (1UL << bit); do { val = *(volatile long *)var; } while (atomic_cmpset_long(var, val, val & ~bit) == 0); @@ -317,7 +317,7 @@ test_and_set_bit(long bit, long *var) var += bit / (sizeof(long) * NBBY); bit %= sizeof(long) * NBBY; - bit = 1 << bit; + bit = (1UL << bit); do { val = *(volatile long *)var; } while (atomic_cmpset_long(var, val, val | bit) == 0);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406151832.s5FIW3cY086761>