lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1CADC42B@AcuExch.aculab.com>
Date:	Thu, 5 Feb 2015 10:14:51 +0000
From:	David Laight <David.Laight@...LAB.COM>
To:	'Chen Gang S' <gang.chen@...rus.com.cn>,
	Marcel Holtmann <marcel@...tmann.org>,
	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
CC:	"Gustavo F. Padovan" <gustavo@...ovan.org>,
	Johan Hedberg <johan.hedberg@...il.com>,
	"David S. Miller" <davem@...emloft.net>,
	"linux-bluetooth@...r.kernel.org" <linux-bluetooth@...r.kernel.org>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2] net: bluetooth: hci_sock: Use 'const void *' instead
 of 'void *' for 2nd parameter of hci_test_bit()

From: Chen Gang S [mailto:gang.chen@...rus.com.cn]
> On 2/5/15 05:09, Marcel Holtmann wrote:
> > Hi Sergei,
> >
> >>>> -static inline int hci_test_bit(int nr, void *addr)
> >>>> +static inline int hci_test_bit(int nr, const void *addr)
> >>>>  {
> >>>>  	return *((__u32 *) addr + (nr >> 5)) & ((__u32) 1 << (nr & 31));
> >>>>  }
> >>
> >>> Is there a 'standard' function lurking that will do the above.
> >>> On x86 the cpus 'bit test' instruction will handle bit numbers
> >>> greater than the word size - so it can be a single instruction.
> >>
> >>   Of course, there's test_bit().
> >
> > we did leave hci_test_bit in the code since there are some userspace facing
> > API that we can not change. Remember that the origin of this code is
> > from 2.4.6 kernel.
> >
> > So we can only change this if you can ensure not to break the userspace API.
> > So might want to write unit tests to ensure working HCI filter before even
> > considering touching this.
> >
> 
> For me, we have to remain hci_test_bit(), it is for "__u32 *" (which we
> can not change). The common test_bit() is for "unsigned long *", in this
> case, I guess it may cause issue under 64-bit environments.

Except that half the time you are passing a 'long *' and you haven't
explained why this isn't broken on 64bit architectures.

Note that on LE systems the size of the accesses used to access a dense
bit array don't matter. This is not true of BE systems.

	David



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ