Re: [PATCH] afs: use BIT_ULL for shifting to fix integer overflow

2019-08-30 Thread Colin Ian King
On 30/08/2019 15:01, David Howells wrote: > Colin King wrote: > >> The expression 1 << nr_slots is evaluated with 32 bit integer arithmetic >> and can overflow before it is widened. > > If it does, it's an error on the part of the caller. See the banner comment: > 1 <= nr_slots <= 9. Doh,

Re: [PATCH] afs: use BIT_ULL for shifting to fix integer overflow

2019-08-30 Thread David Howells
Colin King wrote: > The expression 1 << nr_slots is evaluated with 32 bit integer arithmetic > and can overflow before it is widened. If it does, it's an error on the part of the caller. See the banner comment: 1 <= nr_slots <= 9. And, in any case, if nr_slots >= 64, using BIT_ULL wouldn't

[PATCH] afs: use BIT_ULL for shifting to fix integer overflow

2019-08-30 Thread Colin King
From: Colin Ian King The expression 1 << nr_slots is evaluated with 32 bit integer arithmetic and can overflow before it is widened. Instead, use BIT_ULL to avoid overflow. Addresses-Coverity: ("Unintentional integer overflow") Fixes: 63a4681ff39c ("afs: Locally edit directory data for