[<prev] [next>] [day] [month] [year] [list]
Message-ID: <485E005F.5000903@gmail.com>
Date: Sun, 22 Jun 2008 09:33:51 +0200
From: Michael Kerrisk <mtk.manpages@...il.com>
To: Roman Zippel <zippel@...ux-m68k.org>
CC: lkml <linux-kernel@...r.kernel.org>,
john stultz <johnstul@...ibm.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...e.hu>
Subject: [patch] adjtimex() modes argument checking
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 ||
--
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