Commit 26683005 authored by yidong0635's avatar yidong0635 Committed by Jim Harris
Browse files

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: default avataryidong0635 <dongx.yi@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454539


Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 275f0c34
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;