public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Kerrisk <mtk.manpages@gmail.com>
To: Roman Zippel <zippel@linux-m68k.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
	john stultz <johnstul@us.ibm.com>,
	Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>
Subject: [patch] adjtimex() modes argument checking
Date: Sun, 22 Jun 2008 09:33:51 +0200	[thread overview]
Message-ID: <485E005F.5000903@gmail.com> (raw)
In-Reply-To: <485DF41E.9020909@gmail.com>

Hi Roman,

I see you added a number of new modes to adtimex() in 2.6.26-rc.
Since these are userspace-visible changes, please CC me, so
that they stand a chance of getting documented in man-pages.
(I discovered these changes only by accident.)

I also have some changes to suggest for argument checking, which,
if I understand the code correctly, prevent obvious screw-ups by
callers of adjtimex().  What do you think of the patch below?

Cheers,

Michael

--- linux-2.6.26-rc6/kernel/time/ntp.c        2008-06-22 09:05:05.000000000 +0200
+++ linux-2.6.26-rc6-p/kernel/time/ntp.c       2008-06-22 09:04:31.000000000 +0200
@@ -292,6 +292,16 @@
                         return -EINVAL;
         }

+       /* These modes are the converse of one another  */
+
+       if ((txc->modes & ADJ_MICRO) && (txc->modes & ADJ_NANO))
+               return -EINVAL;
+
+       /* Both of the following want to use txc->constant */
+
+       if ((txc->modes & ADJ_TIMECONST) && (txc->modes & ADJ_TAI))
+               return -EINVAL;
+
         /* if the quartz is off by more than 10% something is VERY wrong ! */
         if (txc->modes & ADJ_TICK)
                 if (txc->tick <  900000/USER_HZ ||



      parent reply	other threads:[~2008-06-23  8:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <485DF41E.9020909@gmail.com>
2008-06-22  7:32 ` [patch] ADJ_OFFSET_SS_READ and capabilities Michael Kerrisk
2008-06-30 22:07   ` john stultz
2008-07-21 10:38     ` Michael Kerrisk
2008-06-22  7:33 ` Michael Kerrisk [this message]

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=485E005F.5000903@gmail.com \
    --to=mtk.manpages@gmail.com \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=zippel@linux-m68k.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox