scsi/bdev: assert on failed data buffer malloc

Change-Id: I4f698d7c35e3315c86a6dc15b930c349ba6b105f
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Changpeng Liu 2017-03-28 14:00:38 +08:00 committed by Ben Walker
parent a1ed48c970
commit fa9d3466aa

View File

@ -1724,6 +1724,7 @@ spdk_bdev_scsi_process_primary(struct spdk_bdev *bdev,
alloc_len = from_be16(&cdb[3]);
data_len = SPDK_MAX(4096, alloc_len);
data = spdk_zmalloc(data_len, 0, NULL);
assert(data != NULL);
rc = spdk_bdev_scsi_inquiry(bdev, task, cdb, data, data_len);
data_len = SPDK_MIN(rc, data_len);
if (rc < 0) {
@ -1747,6 +1748,7 @@ spdk_bdev_scsi_process_primary(struct spdk_bdev *bdev,
data_len = SPDK_MAX(4096, alloc_len);
data = spdk_zmalloc(data_len, 0, NULL);
assert(data != NULL);
rc = spdk_bdev_scsi_report_luns(task->lun, sel, data, data_len);
data_len = rc;
if (rc < 0) {
@ -1854,6 +1856,7 @@ spdk_bdev_scsi_process_primary(struct spdk_bdev *bdev,
data_len = rc;
data = spdk_zmalloc(data_len, 0, NULL);
assert(data != NULL);
/* First call with no buffer to discover needed buffer size */
rc = spdk_bdev_scsi_mode_sense(bdev, md,
@ -1895,6 +1898,7 @@ spdk_bdev_scsi_process_primary(struct spdk_bdev *bdev,
data_len = task->sense_data_len;
data = spdk_zmalloc(data_len, 0, NULL);
assert(data != NULL);
memcpy(data, task->sense_data, data_len);
break;
}