diff --git a/test/unit/lib/bdev/crypto.c/crypto_ut.c b/test/unit/lib/bdev/crypto.c/crypto_ut.c index ec3ba2320..5b6c51828 100644 --- a/test/unit/lib/bdev/crypto.c/crypto_ut.c +++ b/test/unit/lib/bdev/crypto.c/crypto_ut.c @@ -781,6 +781,10 @@ test_initdrivers(void) static void test_crypto_op_complete(void) { + /* Need to prove to scan-build that we are setting iov_bases properly. */ + void *old_iov_base; + struct crypto_bdev_io *orig_ctx; + /* Make sure completion code respects failure. */ g_bdev_io->internal.status = SPDK_BDEV_IO_STATUS_FAILED; g_completion_called = false; @@ -803,6 +807,8 @@ test_crypto_op_complete(void) MOCK_SET(spdk_bdev_writev_blocks, 0); /* Code under test will free this, if not ASAN will complain. */ g_io_ctx->cry_iov.iov_base = spdk_dma_malloc(16, 0x10, NULL); + orig_ctx = (struct crypto_bdev_io *)g_bdev_io->driver_ctx; + 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_SUCCESS); CU_ASSERT(g_completion_called == true); @@ -814,6 +820,7 @@ test_crypto_op_complete(void) 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); + 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); CU_ASSERT(g_completion_called == true);