Re: [PATCH][next] afs: fix integer overflow when shifting 1 more than 32 places

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Colin Ian King <colin.king@xxxxxxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux