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> | 2011-01-26 17:44:45 -0500 |
commit | f0b123c9458d6046c635a60bc41ad56135c09011 (patch) | |
tree | 53bf6c56071c02d3ba4d5f8d113fa323ede7532d | |
parent | 5c5456402d467969b217d7fdd6670f8c8600f5a8 (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 5d20276e44f4..867239875eef 100644 --- a/include/litmus/litmus.h +++ b/include/litmus/litmus.h | |||
@@ -88,7 +88,7 @@ inline static int budget_exhausted(struct task_struct* t) | |||
88 | inline static lt_t budget_remaining(struct task_struct* t) | 88 | inline static lt_t budget_remaining(struct task_struct* t) |
89 | { | 89 | { |
90 | if (!budget_exhausted(t)) | 90 | if (!budget_exhausted(t)) |
91 | return get_exec_time(t) - get_exec_cost(t); | 91 | return get_exec_cost(t) - get_exec_time(t); |
92 | else | 92 | else |
93 | /* avoid overflow */ | 93 | /* avoid overflow */ |
94 | return 0; | 94 | return 0; |