lib/ftl: fix NPA in ftl_band_reloc_free

Stumbled on this one trying to fix new scan-build errors for clang 8 on
fedora 30. scan-build fails because there are paths where this can
result in a null pointer access.

Change-Id: I408376e7eab79ab6d99c35cc662f5737e3518e71
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456671
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Seth Howell 2019-06-03 11:11:29 -07:00 committed by Jim Harris
parent 9a73633190
commit d7ead05419

View File

@ -612,7 +612,7 @@ ftl_band_reloc_init(struct ftl_reloc *reloc, struct ftl_band_reloc *breloc,
static void
ftl_band_reloc_free(struct ftl_band_reloc *breloc)
{
struct ftl_reloc *reloc = breloc->parent;
struct ftl_reloc *reloc;
struct ftl_io *io;
size_t i, num_ios;
@ -620,6 +620,8 @@ ftl_band_reloc_free(struct ftl_band_reloc *breloc)
return;
}
reloc = breloc->parent;
if (breloc->active) {
num_ios = spdk_ring_dequeue(breloc->write_queue, (void **)reloc->io, reloc->max_qdepth);
for (i = 0; i < num_ios; ++i) {