[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <62e9abc2-b639-419c-afa7-e89054f7dce9@canonical.com>
Date: Wed, 11 Apr 2018 14:42:47 +0100
From: Colin Ian King <colin.king@...onical.com>
To: David Howells <dhowells@...hat.com>
Cc: 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
On 11/04/18 14:39, David Howells wrote:
> Colin King <colin.king@...onical.com> wrote:
>
>> Shifting 1 (a 32 bit signed int) more than 32 places will overflow
>> the int, so explicitly use 1ULL to avoid this overflow.
>> ...
>> - 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.
>
> David
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" 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