[PATCH 2/2] options: catch division by zero in setting CPU affinity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Vincent Fu <vincent.fu@xxxxxxx>

Catch a division by zero and abort with a helpful message instead of a
signal 8 floating point error.
---
 options.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/options.c b/options.c
index 6d832354..95086074 100644
--- 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;
-- 
2.17.1




[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux