options: catch division by zero in setting CPU affinity
authorVincent Fu <vincent.fu@wdc.com>
Tue, 19 Feb 2019 21:44:08 +0000 (16:44 -0500)
committerJens Axboe <axboe@kernel.dk>
Thu, 21 Feb 2019 17:55:32 +0000 (10:55 -0700)
Catch a division by zero and abort with a helpful message instead of a
signal 8 floating point error.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
options.c

index 6d832354e95d856e89f2c41d6d5691cbd4d8d49c..9508607438a5149df800322f6c081ea6348d39bc 100644 (file)
--- a/options.c
+++ b/options.c
@@ -493,6 +493,9 @@ int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
        const long max_cpu = cpus_online();
 
        cpus_in_mask = fio_cpu_count(mask);
+       if (!cpus_in_mask)
+               return 0;
+
        cpu_index = cpu_index % cpus_in_mask;
 
        index = 0;