>________________________________________
>From: Chris Johns [chr...@rtems.org]
>Sent: Tuesday, September 10, 2013 2:53 PM
>To: Gedare Bloom
>Cc: Rempel, Cynthia; rtems-devel@rtems.org
>Subject: Re: Coverity CID: 1063861
>
>Gedare Bloom wrote:
>> Hi,
>> Is this condition even possible?
According to Coverity after meeting 100+ conditions, it's possible...
>>
>> Also, would it make more sense to just assign task_load to 0, or maybe
>> not scale it (just set it to load[i])?
>>
>
>I agree, the load should be set to 0.
I didn't know what to set it to... setting the load to 0...
>Chris
From 86642675f4cece741dfc477f703dc5797edb4b51 Mon Sep 17 00:00:00 2001
From: Cynthia Rempel <cynt...@rtems.org>
Date: Mon, 9 Sep 2013 22:27:29 -0700
Subject: [PATCH 1] Coverity CID 1063861
divide-by-zero error
---
cpukit/libmisc/capture/capture-cli.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/cpukit/libmisc/capture/capture-cli.c b/cpukit/libmisc/capture/capture-cli.c
index 4cf9b6b..392b030 100644
--- a/cpukit/libmisc/capture/capture-cli.c
+++ b/cpukit/libmisc/capture/capture-cli.c
@@ -395,7 +395,15 @@ rtems_capture_cli_task_load_thread (rtems_task_argument arg __attribute__((unuse
if (stack_used > 100)
stack_used = 100;
- task_load = (int) ((load[i] * 100000) / total_time);
+ if (total_time != 0)
+ {
+ task_load = (int) ((load[i] * 100000) / total_time);
+ }
+ else
+ {
+ /* divide-by-zero error */
+ task_load = 0;
+ }
priority = rtems_capture_task_real_priority (tasks[i]);
--
1.8.1.2
_______________________________________________
rtems-devel mailing list
rtems-devel@rtems.org
http://www.rtems.org/mailman/listinfo/rtems-devel