All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen: fix 02_sedf_period_lower_neg.py test case
@ 2006-03-07 23:46 Ryan Harper
  0 siblings, 0 replies; only message in thread
From: Ryan Harper @ 2006-03-07 23:46 UTC (permalink / raw)
  To: xen-devel

The follow patch adds some bounds checking to values passed when
changing the period and slice of a domain using the sedf scheduler.  I
picked some values for minimum that seemed sane, but it should be double
checked to make sure that they are OK values.

-- 
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253
ryanh@us.ibm.com


diffstat output:
 sched_sedf.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletion(-)

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
---
diff -r 7fb830a80f6d xen/common/sched_sedf.c
--- a/xen/common/sched_sedf.c	Tue Mar  7 22:04:00 2006
+++ b/xen/common/sched_sedf.c	Tue Mar  7 16:39:10 2006
@@ -56,6 +56,12 @@
 #define EXTRA_QUANTUM (MICROSECS(500)) 
 #define WEIGHT_PERIOD (MILLISECS(100))
 #define WEIGHT_SAFETY (MILLISECS(5))
+
+/* FIXME: need to validate that these are sane */
+#define PERIOD_MAX ULONG_MAX
+#define PERIOD_MIN (MICROSECS(10))
+#define SLICE_MAX ULONG_MAX
+#define SLICE_MIN (MICROSECS(5))
 
 #define IMPLY(a, b) (!(a) || (b))
 #define EQ(a, b) ((!!(a)) == (!!(b)))
@@ -1609,7 +1615,10 @@
                  * Sanity checking: note that disabling extra weight requires
                  * that we set a non-zero slice.
                  */
-                if ( (cmd->u.sedf.slice == 0) ||
+                if ( (cmd->u.sedf.period > PERIOD_MAX) ||
+                     (cmd->u.sedf.period < PERIOD_MIN) ||
+                     (cmd->u.sedf.slice  > SLICE_MAX)  ||
+                     (cmd->u.sedf.slice  < SLICE_MIN)  ||
                      (cmd->u.sedf.slice > cmd->u.sedf.period) )
                     return -EINVAL;
                 EDOM_INFO(v)->weight = 0;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-03-07 23:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-07 23:46 [PATCH] xen: fix 02_sedf_period_lower_neg.py test case Ryan Harper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.