From 7d4c7b1304581c3271a1ded2c9595ec5df95f8eb Mon Sep 17 00:00:00 2001 From: pluknet Date: Fri, 25 Feb 2011 13:59:59 +0000 Subject: 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 Discussed with: jhb Approved by: kib (mentor) MFC after: 1 week --- usr.sbin/mfiutil/mfi_cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'usr.sbin') diff --git a/usr.sbin/mfiutil/mfi_cmd.c b/usr.sbin/mfiutil/mfi_cmd.c index 07fe148..7fedfb6 100644 --- a/usr.sbin/mfiutil/mfi_cmd.c +++ b/usr.sbin/mfiutil/mfi_cmd.c @@ -316,7 +316,7 @@ mfi_display_progress(const char *label, struct mfi_progress *prog) 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; -- cgit v1.1