nvme_qpair_ut: Fix scanbuild warning about using freed memory.
Issue reports: spdk/test/common/lib/test_env.c:103:2: warning: Use of memory after it is freed HANDLE_RETURN_MOCK(spdk_zmalloc); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ spdk/include/spdk_internal/mock.h:106:3: note: expanded from macro 'HANDLE_RETURN_MOCK' return ut_ ## fn; \ ^~~~~~~~~~~~~~~~ 1 warning generated. Here includes test_env.c. That spdk_zmalloc will call HANDLE_RETURN_MOCK ,that leads requesting memory in functions which call spdk_zmalloc(including nvme_qpair_init/ spdk_nvme_qpair_add_cmd_error_injection) failed. Change-Id: I6c14dfd2fc7b7078a18a46ef8ff830f85940487e Signed-off-by: yidong0635 <dongx.yi@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/462822 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
5094302f5a
commit
3e19963297
@ -81,6 +81,7 @@ prepare_submit_request_test(struct spdk_nvme_qpair *qpair,
|
||||
ctrlr->free_io_qids = NULL;
|
||||
TAILQ_INIT(&ctrlr->active_io_qpairs);
|
||||
TAILQ_INIT(&ctrlr->active_procs);
|
||||
MOCK_CLEAR(spdk_zmalloc);
|
||||
nvme_qpair_init(qpair, 1, ctrlr, 0, 32);
|
||||
}
|
||||
|
||||
@ -319,6 +320,7 @@ test_nvme_qpair_add_cmd_error_injection(void)
|
||||
ctrlr.adminq = &qpair;
|
||||
|
||||
/* Admin error injection at submission path */
|
||||
MOCK_CLEAR(spdk_zmalloc);
|
||||
rc = spdk_nvme_qpair_add_cmd_error_injection(&ctrlr, NULL,
|
||||
SPDK_NVME_OPC_GET_FEATURES, true, 5000, 1,
|
||||
SPDK_NVME_SCT_GENERIC, SPDK_NVME_SC_INVALID_FIELD);
|
||||
|
Loading…
Reference in New Issue
Block a user