From 2b0b705fb178510e6f709343cd968b4b5196b39d Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Thu, 23 Mar 2017 15:52:18 -0700 Subject: [PATCH] reactor: make sure socket_count isn't zero Avoid division by zero in the event mempool cache size calculation. Change-Id: Ic117ef2dc3a798fb0a57572f1178233e83e73849 Signed-off-by: Daniel Verkamp --- lib/event/reactor.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/event/reactor.c b/lib/event/reactor.c index 1228c59216..3278be6987 100644 --- a/lib/event/reactor.c +++ b/lib/event/reactor.c @@ -599,6 +599,10 @@ spdk_reactors_init(const char *mask, unsigned int max_delay_us) socket_count++; } } + if (socket_count == 0) { + printf("No sockets occupied (internal error)\n"); + return -1; + } for (i = 0; i < SPDK_MAX_SOCKET; i++) { if ((1ULL << i) & socket_mask) {