vhost: Handle null pointer when dumping SCSI JSON config

Change-Id: I4bec75ee2965394edb294a163818925e6a26fb0c
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/408239
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ben Walker 2018-04-18 13:40:51 -07:00 committed by Jim Harris
parent aa345078c1
commit c1f7f02cfe

View File

@ -1228,10 +1228,15 @@ spdk_vhost_scsi_dump_info_json(struct spdk_vhost_dev *vdev, struct spdk_json_wri
static void static void
spdk_vhost_scsi_write_config_json(struct spdk_vhost_dev *vdev, struct spdk_json_write_ctx *w) spdk_vhost_scsi_write_config_json(struct spdk_vhost_dev *vdev, struct spdk_json_write_ctx *w)
{ {
struct spdk_vhost_scsi_dev *svdev = to_scsi_dev(vdev); struct spdk_vhost_scsi_dev *svdev;
struct spdk_scsi_lun *lun; struct spdk_scsi_lun *lun;
uint32_t i; uint32_t i;
svdev = to_scsi_dev(vdev);
if (!svdev) {
return;
}
spdk_json_write_object_begin(w); spdk_json_write_object_begin(w);
spdk_json_write_named_string(w, "method", "construct_vhost_scsi_controller"); spdk_json_write_named_string(w, "method", "construct_vhost_scsi_controller");