[PATCH] rtems: Fix _Rate_monotonic_Renew_deadline()

Kuan-Hsun Chen c0066c at gmail.com
Wed Jan 25 14:48:19 UTC 2017


---
 cpukit/rtems/src/ratemontimeout.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/cpukit/rtems/src/ratemontimeout.c b/cpukit/rtems/src/ratemontimeout.c
index bcc4ccf..079ad41 100644
--- a/cpukit/rtems/src/ratemontimeout.c
+++ b/cpukit/rtems/src/ratemontimeout.c
@@ -9,7 +9,7 @@
  *  COPYRIGHT (c) 1989-2009.
  *  On-Line Applications Research Corporation (OAR).
  *
- *  COPYRIGHT (c) 2016 Kuan-Hsun Chen.
+ *  COPYRIGHT (c) 2017 Kuan-Hsun Chen.
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -30,7 +30,10 @@ static void _Rate_monotonic_Renew_deadline(
 {
   uint64_t deadline;
 
-  ++the_period->postponed_jobs;
+  /** stay at 0xffffffff if postponed_jobs is going to overflow */
+  if ( the_period->postponed_jobs != UINT_MAX ) {
+    ++the_period->postponed_jobs;
+  }
   the_period->state = RATE_MONOTONIC_EXPIRED;
 
   deadline = _Watchdog_Per_CPU_insert_relative(
-- 
1.9.1



More information about the devel mailing list