Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Feb 2011 13:59:59 +0000 (UTC)
From:      Sergey Kandaurov <pluknet@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r219031 - head/usr.sbin/mfiutil
Message-ID:  <201102251359.p1PDxxT0053382@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pluknet
Date: Fri Feb 25 13:59:59 2011
New Revision: 219031
URL: http://svn.freebsd.org/changeset/base/219031

Log:
  Fix division by zero, causing floating point exception in a drive progress
  command.
  
  It was possible to read a value of zero from a busy controller used
  as the divisor to calculate the remaining rebuild time.
  
  Reported by:	Pavel Udovenko <udovenko att nic.ru>
  Discussed with:	jhb
  Approved by:	kib (mentor)
  MFC after:	1 week

Modified:
  head/usr.sbin/mfiutil/mfi_cmd.c

Modified: head/usr.sbin/mfiutil/mfi_cmd.c
==============================================================================
--- head/usr.sbin/mfiutil/mfi_cmd.c	Fri Feb 25 12:46:43 2011	(r219030)
+++ head/usr.sbin/mfiutil/mfi_cmd.c	Fri Feb 25 13:59:59 2011	(r219031)
@@ -316,7 +316,7 @@ mfi_display_progress(const char *label, 
 
 	printf("%s: %.2f%% complete, after %ds", label,
 	    (float)prog->progress * 100 / 0xffff, prog->elapsed_seconds);
-	if (prog->elapsed_seconds > 10) {
+	if (prog->progress != 0 && prog->elapsed_seconds > 10) {
 		printf(" finished in ");
 		seconds = (0x10000 * (uint32_t)prog->elapsed_seconds) /
 		    prog->progress - prog->elapsed_seconds;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102251359.p1PDxxT0053382>