From be6bf3ca538405037fb04ee2584ea57435c9770b Mon Sep 17 00:00:00 2001 From: "Bjoern B. Brandenburg" Date: Wed, 22 Sep 2010 12:46:02 -0400 Subject: zero out rt_task parameters before setting them This avoids passing random stack contents to the kernel if the structure gained some fields due to plugin development. (Also, fix up some white space issues while we are at it.) --- src/litmus.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/litmus.c b/src/litmus.c index f71f337..d3cc6bb 100644 --- a/src/litmus.c +++ b/src/litmus.c @@ -10,14 +10,14 @@ #include "litmus.h" #include "internal.h" -void show_rt_param(struct rt_task* tp) +void show_rt_param(struct rt_task* tp) { printf("rt params:\n\t" "exec_cost:\t%llu\n\tperiod:\t\t%llu\n\tcpu:\t%d\n", tp->exec_cost, tp->period, tp->cpu); } -task_class_t str2class(const char* str) +task_class_t str2class(const char* str) { if (!strcmp(str, "hrt")) return RT_CLASS_HARD; @@ -55,6 +55,12 @@ int sporadic_task_ns(lt_t e, lt_t p, lt_t phase, { struct rt_task param; int ret; + + /* Zero out first --- this is helpful when we add plugin-specific + * parameters during development. + */ + memset(¶m, 0, sizeof(param)); + param.exec_cost = e; param.period = p; param.cpu = cpu; @@ -62,7 +68,7 @@ int sporadic_task_ns(lt_t e, lt_t p, lt_t phase, param.phase = phase; param.budget_policy = budget_policy; - if (set_cpu_set) { + if (set_cpu_set) { ret = be_migrate_to(cpu); check("migrate to cpu"); } -- cgit v1.2.2