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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <55AD91A8.8060800@roeck-us.net>
Date:	Mon, 20 Jul 2015 17:26:16 -0700
From:	Guenter Roeck <linux@...ck-us.net>
To:	Andrew Morton <akpm@...ux-foundation.org>,
	Rasmus Villemoes <linux@...musvillemoes.dk>
CC:	Sowmini Varadhan <sowmini.varadhan@...cle.com>,
	linux-kernel@...r.kernel.org, benh@...nel.crashing.org,
	davem@...emloft.net
Subject: Re: [PATCH] iommu-common: Do not use 64 bit  constant 0xffffffffffffffffl
 for computing align_mask

On 07/20/2015 04:28 PM, Andrew Morton wrote:
> On Mon, 20 Jul 2015 19:57:18 +0200 Rasmus Villemoes <linux@...musvillemoes.dk> wrote:
>
>> On Mon, Jul 20 2015, Guenter Roeck <linux@...ck-us.net> wrote:
>>
>>> So either case ~0l appears to be wrong; it should be ~0ul.
>>
>> Yes, right-shifting -1 of any type is probably always wrong, as it will
>> always give -1 again.
>
> Not for unsigned types.
>
> The kernel uses "-1UL" and "-1ULL" quite a lot - it's a convenient way
> of saying "all ones, regardless of size".  Also, assigning plain old
> "-1" to an unsigned variable will make that variable all-ones
> regardless of size.
>
> In this case I expect we could do
>
> 	align_mask = -1UL >> (64 - align_order);
>
-1ul works, at least on x86 (32 and 64 bit).

> but I don't know about that 64.  Maybe it should be BITS_PER_LONG?
>
I think that is going to be in the next version of the patch.

Guenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ