From 26683005dd6aabf5a67c41d167e6109e5b8ae4e0 Mon Sep 17 00:00:00 2001 From: yidong0635 Date: Wed, 15 May 2019 08:30:00 -0400 Subject: [PATCH] lib/ftl: fix scanbuild error about divided by zero. We should add assert here to avoid be divided by zero, that resolve this scanbuild error. Change-Id: I12fa11cdbf0f608995f91759140408303e243357 Signed-off-by: yidong0635 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454539 Reviewed-by: Darek Stojaczyk Reviewed-by: Jim Harris Tested-by: SPDK CI Jenkins --- lib/ftl/ftl_band.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ftl/ftl_band.c b/lib/ftl/ftl_band.c index d622edceb..f106bfb5d 100644 --- a/lib/ftl/ftl_band.c +++ b/lib/ftl/ftl_band.c @@ -581,6 +581,7 @@ ftl_band_next_xfer_ppa(struct ftl_band *band, struct ftl_ppa ppa, size_t num_lbk } assert(band->num_chunks == _num_chunks); #endif + assert(band->num_chunks != 0); num_stripes = (num_lbks / dev->xfer_size) / band->num_chunks; ppa.lbk += num_stripes * dev->xfer_size; num_lbks -= num_stripes * dev->xfer_size * band->num_chunks;