test/crypto_ut: change alignment of allocation

This is intended to avoid a crypto failure when we have ASAN disabled.
In order to appease a scan-build error, we have to assert that the
memory address for two g_io_ctx->cry_iov.iov_base is different between
runs of _crypto_operation_complete. However, when we have asan disabled,
two subsequest calls to spdk_dma_malloc yield the same address, so
change the alignment to prevent allocating the same address.

Change-Id: Ia3dfbec5bb16d00bbe7dc136a886e0b9caea71a7
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/442413
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Seth Howell 2019-01-28 10:57:24 -07:00 committed by Darek Stojaczyk
parent 552e21cce6
commit 9042f3468b

View File

@ -821,7 +821,10 @@ test_crypto_op_complete(void)
g_completion_called = false;
MOCK_SET(spdk_bdev_writev_blocks, -1);
/* Code under test will free this, if not ASAN will complain. */
g_io_ctx->cry_iov.iov_base = spdk_dma_malloc(16, 0x10, NULL);
g_io_ctx->cry_iov.iov_base = spdk_dma_malloc(16, 0x40, NULL);
/* To Do: remove this garbage assert as soon as scan-build stops throwing a
* heap use after free error.
*/
SPDK_CU_ASSERT_FATAL(old_iov_base != orig_ctx->cry_iov.iov_base);
_crypto_operation_complete(g_bdev_io);
CU_ASSERT(g_bdev_io->internal.status == SPDK_BDEV_IO_STATUS_FAILED);