Commit d7ead054 authored by Seth Howell's avatar Seth Howell Committed by Jim Harris
Browse files

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: default avatarSeth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456671


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 9a736331
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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) {