LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Roman Zippel <zippel@linux-m68k.org>
Cc: john stultz <johnstul@us.ibm.com>, Ingo Molnar <mingo@elte.hu>,
Thomas Gleixner <tglx@linutronix.de>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Avoid time_offset overflows
Date: Sun, 25 Mar 2007 01:09:03 -0800 [thread overview]
Message-ID: <20070325010903.a0e6e624.akpm@linux-foundation.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0703240153220.14457@scrub.home>
On Sat, 24 Mar 2007 06:20:45 +0100 (CET) Roman Zippel <zippel@linux-m68k.org> wrote:
> Hi,
>
> On Fri, 23 Mar 2007, john stultz wrote:
>
> > @@ -314,8 +314,8 @@ #endif
> > freq_adj += time_freq;
> > freq_adj = min(freq_adj, (s64)MAXFREQ_NSEC);
> > time_freq = max(freq_adj, (s64)-MAXFREQ_NSEC);
> > - time_offset = (time_offset / NTP_INTERVAL_FREQ)
> > - << SHIFT_UPDATE;
> > + do_div(time_offset, NTP_INTERVAL_FREQ);
> > + time_offset <<= SHIFT_UPDATE;
> > } /* STA_PLL */
> > } /* txc->modes & ADJ_OFFSET */
> > if (txc->modes & ADJ_TICK)
>
> This is wrong, time_offset is signed and do_div is unsigned.
> In general I planned to do the same change, but the do_div API could use a
> little cleanup to provide some clear function for signed/unsigned divide
> (hopefully with a better name than div_long_long_rem_signed or
> do_div_llr).
>
Can we do a minimal thing for 2.6.21, worry about API beautification later?
next prev parent reply other threads:[~2007-03-25 9:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-24 0:40 john stultz
2007-03-24 5:20 ` Roman Zippel
2007-03-25 9:09 ` Andrew Morton [this message]
2007-03-25 11:07 ` Thomas Gleixner
2007-03-25 11:14 ` [patch] ntp: avoid integer overflow in do_adjtimex() Ingo Molnar
2007-03-25 13:01 ` Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070325010903.a0e6e624.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=zippel@linux-m68k.org \
--subject='Re: [PATCH] Avoid time_offset overflows' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).