Commit 9042f346 authored by Seth Howell's avatar Seth Howell Committed by Darek Stojaczyk
Browse files

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: default avatarSeth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/442413


Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
parent 552e21cc
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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);