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: <24493.1523455816@warthog.procyon.org.uk>
Date:   Wed, 11 Apr 2018 15:10:16 +0100
From:   David Howells <dhowells@...hat.com>
To:     Colin Ian King <colin.king@...onical.com>
Cc:     dhowells@...hat.com, linux-afs@...ts.infradead.org,
        kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] afs: fix integer overflow when shifting 1 more than 32 places

Colin Ian King <colin.king@...onical.com> wrote:

> >> -	mask = (1 << nr_slots) - 1;
> >> +	mask = (1ULL << nr_slots) - 1;
> > 
> > nr_slots cannot be larger than 9, so what I wrote is actually fine and is
> > more efficient on a 32-bit machine.
> 
> ok, sorry about the noise.

It would be possible to cast the value to u64 before assigning it, I suppose.
Would that help?  E.g.:

	mask = (u64)((1 << nr_slots) - 1);

It looks a bit odd, though, since the cast is made implicitly anyway.

David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ