All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ryan Harper <ryanh@us.ibm.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] xen: fix 02_sedf_period_lower_neg.py test case
Date: Tue, 7 Mar 2006 17:46:21 -0600	[thread overview]
Message-ID: <20060307234621.GI15536@us.ibm.com> (raw)

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;

                 reply	other threads:[~2006-03-07 23:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20060307234621.GI15536@us.ibm.com \
    --to=ryanh@us.ibm.com \
    --cc=xen-devel@lists.xensource.com \
    /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 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.