Re: divide error trying to set rt_period to zero

From: Raistlin
Date: Thu Jun 26 2008 - 14:17:59 EST


On Thu, 2008-06-26 at 15:39 +0200, Ingo Molnar wrote:
> > @@ -8501,6 +8501,9 @@ int sched_group_set_rt_period(struct task_group
> > *tg, long rt_period_us)
> > rt_period = (u64)rt_period_us * NSEC_PER_USEC;
> > rt_runtime = tg->rt_bandwidth.rt_runtime;
> >
> > + if (period == 0)
> > + return -EINVAL;
>
> this patch doesnt even build, because there's no "period" variable.
Ops! :-O

My fault, moving the 'if' back and forth from one function to another I
finally sent the wrong (and broken!) version of the patch... Very sorry
about it!

I know, I would have noticed just looking at the code... But I missed
it. :-(

Anyway, if still interested in, the following one build and work... I've
just tried it and I'm quite sure this time. :-P

Sorry again and Regards,
Dario Faggioli

Signed-off-by: Dario Faggioli <raistlin@xxxxxxxx>
Signed-off-by: Michael Trimarchi <trimarchimichael@xxxxxxxx>
---
diff --git a/kernel/sched.c b/kernel/sched.c
index 3aaa5c8..696758f 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -8501,6 +8501,9 @@ int sched_group_set_rt_period(struct task_group
*tg, long rt_period_us)
rt_period = (u64)rt_period_us * NSEC_PER_USEC;
rt_runtime = tg->rt_bandwidth.rt_runtime;

+ if (rt_period == 0)
+ return -EINVAL;
+
return tg_set_bandwidth(tg, rt_period, rt_runtime);
}

--
<<This happens because I choose it to happen!>>
(Raistlin Majere, DragonLance Chronicles -Dragons of Spring Drawning-)
----------------------------------------------------------------------
Dario Faggioli
GNU/Linux Registered User: #340657
Web: http://www.linux.it/~raistlin
Blog: http://blog.linux.it/raistlin
SIP Account: dario.faggioli@xxxxxxxxxxxxxxxxx or
raistlin@xxxxxxxxx
Jabber Account: dario.faggioli@xxxxxxxxxx/WengoPhone
GnuPG Key ID: 4DC83AC4
GnuPG Key Fingerprint: 2A78 AD5D B9CF A082 0836 08AD 9385 DA04 4DC8 3AC4

Attachment: signature.asc
Description: This is a digitally signed message part