Hi,

Attached is a patch to check for dividing by zero in capture-cli.c...

Thanks,
Cindy
From 86642675f4cece741dfc477f703dc5797edb4b51 Mon Sep 17 00:00:00 2001
From: Cynthia Rempel <[email protected]>
Date: Mon, 9 Sep 2013 22:27:29 -0700
Subject: [PATCH] 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 = -1;
+      }
 
       priority = rtems_capture_task_real_priority (tasks[i]);
 
-- 
1.8.1.2

_______________________________________________
rtems-devel mailing list
[email protected]
http://www.rtems.org/mailman/listinfo/rtems-devel

Reply via email to