lkml.org 
[lkml]   [2008]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
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 ||



\
 
 \ /
  Last update: 2008-06-23 10:21    [W:9.170 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site