Commit 8389b65a authored by Mike Gerdts's avatar Mike Gerdts Committed by Jim Harris
Browse files

blobcli: do not read from an zero-length blob



Not all blobs have data: an lvstore's super blob is a common
example. Perform a size check prior to trying to dump the blob's
contents.

Signed-off-by: default avatarMike Gerdts <mgerdts@nvidia.com>
Change-Id: Ic5bc1b11cdda72a36c6a3f4b4de0fd6f1a2948c6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11246


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarKrzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 76a577b0
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -701,6 +701,12 @@ dump_imp_open_cb(void *cb_arg, struct spdk_blob *blob, int bserrno)
			return;
		}

		if (cli_context->blob->active.num_clusters == 0) {
			fclose(cli_context->fp);
			spdk_blob_close(cli_context->blob, close_cb, cli_context);
			return;
		}

		/* read a io_unit of data from the blob */
		spdk_blob_io_read(cli_context->blob, cli_context->channel,
				  cli_context->buff, cli_context->io_unit_count,