From owner-svn-src-stable-10@FreeBSD.ORG  Sun Jun 15 18:32:03 2014
Return-Path: <owner-svn-src-stable-10@FreeBSD.ORG>
Delivered-To: svn-src-stable-10@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 520698E2;
 Sun, 15 Jun 2014 18:32:03 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 3DF49259B;
 Sun, 15 Jun 2014 18:32:03 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5FIW35Z086762;
 Sun, 15 Jun 2014 18:32:03 GMT
 (envelope-from hselasky@svn.freebsd.org)
Received: (from hselasky@localhost)
 by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5FIW3cY086761;
 Sun, 15 Jun 2014 18:32:03 GMT
 (envelope-from hselasky@svn.freebsd.org)
Message-Id: <201406151832.s5FIW3cY086761@svn.freebsd.org>
From: Hans Petter Selasky <hselasky@FreeBSD.org>
Date: Sun, 15 Jun 2014 18:32:03 +0000 (UTC)
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
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-stable-10@freebsd.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: SVN commit messages for only the 10-stable src tree
 <svn-src-stable-10.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-stable-10>, 
 <mailto:svn-src-stable-10-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-10/>
List-Post: <mailto:svn-src-stable-10@freebsd.org>
List-Help: <mailto:svn-src-stable-10-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10>, 
 <mailto:svn-src-stable-10-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 15 Jun 2014 18:32:03 -0000

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);