diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2010-11-29 09:20:03 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2010-11-29 12:58:09 -0500 |
commit | f07bb0a4549916107a7619d0bc4cb5dc09d5744a (patch) | |
tree | e8d1bf719eccb3a3c82feeb919207b164ebaa2a9 | |
parent | 7b544c16beaa1f6ec70a72d53fe84cae95f70a41 (diff) |
bugfix: avoid underflow in budget_remaining()
budget_remaining() reports incorrect values due to the operands being
switched, which leads to an integer underflow.
Reported-by: Chris Kenna <cjk@cs.unc.edu>
-rw-r--r-- | include/litmus/litmus.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/litmus/litmus.h b/include/litmus/litmus.h index 30f41869b455..246483783fc0 100644 --- a/include/litmus/litmus.h +++ b/include/litmus/litmus.h | |||
@@ -62,7 +62,7 @@ inline static int budget_exhausted(struct task_struct* t) | |||
62 | inline static lt_t budget_remaining(struct task_struct* t) | 62 | inline static lt_t budget_remaining(struct task_struct* t) |
63 | { | 63 | { |
64 | if (!budget_exhausted(t)) | 64 | if (!budget_exhausted(t)) |
65 | return get_exec_time(t) - get_exec_cost(t); | 65 | return get_exec_cost(t) - get_exec_time(t); |
66 | else | 66 | else |
67 | /* avoid overflow */ | 67 | /* avoid overflow */ |
68 | return 0; | 68 | return 0; |