[PATCH] rtems: Fix _Rate_monotonic_Renew_deadline()

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Jan 25 14:53:54 UTC 2017



On 25/01/17 15:48, Kuan-Hsun Chen wrote:
> ---
>   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.

This should be 2016, 2017 or 2016-2017.

>    *
>    *  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 */

/** is a Doxygen comment.

> +  if ( the_period->postponed_jobs != UINT_MAX ) {
> +    ++the_period->postponed_jobs;
> +  }

Type is uint32_t, not unsigned int. So, use UINT32_MAX. Maybe

  Empty lines between blocks.

>     the_period->state = RATE_MONOTONIC_EXPIRED;
>
>     deadline = _Watchdog_Per_CPU_insert_relative(

We need a test case for this overflow condition. You probably have to 
modify the_period->postponed_jobs by hand in the test case to avoid 
extremely long test run times.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




More information about the devel mailing list