mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-01 12:19:28 +00:00
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
This commit is contained in:
parent
9a253c101e
commit
023c93f2c8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=219031
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user