test/unit: Fix Scan-build errors in scsi tests

I had to make small modifications to one test in the dev_ut.c file to
prevent a memory leak error. However, changing the index in this test
from -1 to 0 has no effect on the coverage.

Change-Id: Ia8a475aaa41118f072a5d9006bab9d9c84b4a10a
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/424126
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Seth Howell 2018-08-30 13:36:33 -07:00 committed by Jim Harris
parent c0297f9c71
commit 17e9d38c5b
2 changed files with 8 additions and 1 deletions

View File

@ -555,8 +555,9 @@ dev_add_lun_bdev_not_found(void)
int rc; int rc;
struct spdk_scsi_dev dev = {0}; struct spdk_scsi_dev dev = {0};
rc = spdk_scsi_dev_add_lun(&dev, "malloc2", -1, NULL, NULL); rc = spdk_scsi_dev_add_lun(&dev, "malloc2", 0, NULL, NULL);
SPDK_CU_ASSERT_FATAL(dev.lun[0] == NULL);
CU_ASSERT_NOT_EQUAL(rc, 0); CU_ASSERT_NOT_EQUAL(rc, 0);
} }

View File

@ -689,6 +689,8 @@ lba_range_test(void)
ut_init_task(&task); ut_init_task(&task);
task.lun = &lun; task.lun = &lun;
task.lun->bdev_desc = NULL;
task.lun->io_channel = NULL;
task.cdb = cdb; task.cdb = cdb;
memset(cdb, 0, sizeof(cdb)); memset(cdb, 0, sizeof(cdb));
@ -760,6 +762,8 @@ xfer_len_test(void)
ut_init_task(&task); ut_init_task(&task);
task.lun = &lun; task.lun = &lun;
task.lun->bdev_desc = NULL;
task.lun->io_channel = NULL;
task.cdb = cdb; task.cdb = cdb;
memset(cdb, 0, sizeof(cdb)); memset(cdb, 0, sizeof(cdb));
@ -847,6 +851,8 @@ _xfer_test(bool bdev_io_pool_full)
/* Read 1 block */ /* Read 1 block */
ut_init_task(&task); ut_init_task(&task);
task.lun = &lun; task.lun = &lun;
task.lun->bdev_desc = NULL;
task.lun->io_channel = NULL;
task.cdb = cdb; task.cdb = cdb;
memset(cdb, 0, sizeof(cdb)); memset(cdb, 0, sizeof(cdb));
cdb[0] = 0x88; /* READ (16) */ cdb[0] = 0x88; /* READ (16) */