From owner-svn-src-all@FreeBSD.ORG Thu Jun 12 13:33:02 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4BE9E58E; Thu, 12 Jun 2014 13:33:02 +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 38D282C47; Thu, 12 Jun 2014 13:33:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5CDX2cR050320; Thu, 12 Jun 2014 13:33:02 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5CDX2b5050319; Thu, 12 Jun 2014 13:33:02 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201406121333.s5CDX2b5050319@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 12 Jun 2014 13:33:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r267395 - head/sys/ofed/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jun 2014 13:33:02 -0000 Author: hselasky Date: Thu Jun 12 13:33:01 2014 New Revision: 267395 URL: http://svnweb.freebsd.org/changeset/base/267395 Log: - Fix out of range shifting bug in bitops.h. - Make code a bit easier to read by adding parenthesis. MFC after: 3 days Sponsored by: Mellanox Technologies Modified: head/sys/ofed/include/linux/bitops.h Modified: head/sys/ofed/include/linux/bitops.h ============================================================================== --- head/sys/ofed/include/linux/bitops.h Thu Jun 12 13:17:11 2014 (r267394) +++ head/sys/ofed/include/linux/bitops.h Thu Jun 12 13:33:01 2014 (r267395) @@ -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);