[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87zflkydgp.ffs@tglx>
Date: Wed, 27 Nov 2024 15:10:30 +0100
From: Thomas Gleixner <tglx@...utronix.de>
To: "Dalmas, Marcelo (GE Vernova)" <marcelo.dalmas@...com>,
"jstultz@...gle.com" <jstultz@...gle.com>, "sboyd@...nel.org"
<sboyd@...nel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Cc: "Dalmas, Marcelo (GE Vernova)" <marcelo.dalmas@...com>
Subject: Re: [PATCH] ntp: fix bug in adjtimex reading time offset
On Mon, Nov 25 2024 at 12:16, Marcelo Dalmas wrote:
> Due to an unsigned cast, adjtimex returns wrong offest when using ADJ_MICRO and the offset is negative.
> In this case a small negative offset return approximately 4.29 seconds (~ 2^32/1000 milliseconds).
Nice find. Please format the changelog to be within ~72 characters per
line next time.
> Signed-off-by: Marcelo Dalmas <marcelo.dalmas@...com>
> ---
> kernel/time/ntp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
> index b550ebe0f03b..02e7fe6a0afa 100644
> --- a/kernel/time/ntp.c
> +++ b/kernel/time/ntp.c
> @@ -798,7 +798,7 @@ int __do_adjtimex(struct __kernel_timex *txc, const struct timespec64 *ts,
>
> txc->offset = shift_right(ntpdata->time_offset * NTP_INTERVAL_FREQ, NTP_SCALE_SHIFT);
> if (!(ntpdata->time_status & STA_NANO))
> - txc->offset = (u32)txc->offset / NSEC_PER_USEC;
> + txc->offset /= NSEC_PER_USEC;
This patch is white space damaged. (tabs are replaced with spaces).
I fixed it up to you this time. Please send your next patch to yourself
first and verify that it applies cleanly.
Thanks,
tglx
Powered by blists - more mailing lists