Flexible I/O Tester development
 help / color / mirror / Atom feed
From: vincentfu@gmail.com
To: axboe@kernel.dk, fio@vger.kernel.org
Cc: Vincent Fu <vincent.fu@wdc.com>
Subject: [PATCH 2/2] options: catch division by zero in setting CPU affinity
Date: Tue, 19 Feb 2019 16:44:08 -0500	[thread overview]
Message-ID: <20190219214408.14207-3-vincentfu@gmail.com> (raw)
In-Reply-To: <20190219214408.14207-1-vincentfu@gmail.com>

From: Vincent Fu <vincent.fu@wdc.com>

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



  parent reply	other threads:[~2019-02-19 21:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-19 21:44 [PATCH 0/2] stat/options patches vincentfu
2019-02-19 21:44 ` [PATCH 1/2] stat: use long doubles to identify latency percentiles vincentfu
2019-02-19 21:44 ` vincentfu [this message]
2019-02-21 17:55 ` [PATCH 0/2] stat/options patches Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190219214408.14207-3-vincentfu@gmail.com \
    --to=vincentfu@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=fio@vger.kernel.org \
    --cc=vincent.fu@wdc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox