[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <536CF7B3.4040705@zytor.com>
Date: Fri, 09 May 2014 08:43:47 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Boris Ostrovsky <boris.ostrovsky@...cle.com>, tglx@...utronix.de,
mingo@...hat.com
CC: linux-kernel@...r.kernel.org, stefani@...bold.net,
luto@...capital.net, konrad.wilk@...cle.com, stable@...r.kernel.org
Subject: Re: [PATCH] time: Cast tv_nsec to u64 for proper shifting in update_vsyscall()
On 05/09/2014 08:11 AM, Boris Ostrovsky wrote:
> With tk->wall_to_monotonic.tv_nsec being a 32-bit value on 32-bit
> systems, (tk->wall_to_monotonic.tv_nsec << tk->shift) in update_vsyscall()
> may lose upper bits or, worse, add them since compiler will do this:
> (u64)(tk->wall_to_monotonic.tv_nsec << tk->shift)
> instead of
> ((u64)tk->wall_to_monotonic.tv_nsec << tk->shift)
>
> So if, for example, tv_nsec is 0x800000 and shift is 8 we will end up
> with 0xffffffff80000000 instead of 0x80000000. And then we are stuck in
> the subsequent 'while' loop.
>
> We need explicit cast.
>
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@...cle.com>
> Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
> Cc: stable@...r.kernel.org
This is needed in stable only for v3.14, right?
-hpa
--
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