From 9d4fd25774db903b0f25920003a8282ae43a03bf Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sat, 9 Jan 2016 10:05:57 +0100 Subject: [PATCH] Avoid a float division by zero in testing In the regression testing the fake probability goes to 0, resulting in an impossible division. --- cmdline/device.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmdline/device.c b/cmdline/device.c index d2b27f76..3a94274c 100644 --- a/cmdline/device.c +++ b/cmdline/device.c @@ -570,6 +570,10 @@ static double raid_prob_of_one_or_more_failures(double array_failure_rate, doubl * Garth Alan Gibson, "Redundant Disk Arrays: Reliable, Parallel Secondary Storage", 1990 */ + /* avoid division by zero */ + if (array_failure_rate == 0) + return 0; + /* get the Mean Time Between Failure of a single disk */ /* from the array failure rate */ MTBF = n / array_failure_rate;