crypto: switch to spdk_*malloc().
spdk_dma_*malloc() is about to be deprecated. Change-Id: I683ea366da7bb186f16a8084a9c43276ed4fce04 Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449798 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
4ee4023a0d
commit
43e136dfcc
@ -647,8 +647,9 @@ _crypto_operation(struct spdk_bdev_io *bdev_io, enum rte_crypto_cipher_operation
|
||||
* has a buffer, which ours always will. So, until we modify that API
|
||||
* or better yet the current ZCOPY work lands, this is the best we can do.
|
||||
*/
|
||||
io_ctx->cry_iov.iov_base = spdk_dma_malloc(total_length,
|
||||
spdk_bdev_get_buf_align(bdev_io->bdev), NULL);
|
||||
io_ctx->cry_iov.iov_base = spdk_malloc(total_length,
|
||||
spdk_bdev_get_buf_align(bdev_io->bdev), NULL,
|
||||
SPDK_ENV_LCORE_ID_ANY, SPDK_MALLOC_DMA);
|
||||
if (!io_ctx->cry_iov.iov_base) {
|
||||
SPDK_ERRLOG("ERROR trying to allocate write buffer for encryption!\n");
|
||||
rc = -ENOMEM;
|
||||
@ -871,7 +872,7 @@ _complete_internal_write(struct spdk_bdev_io *bdev_io, bool success, void *cb_ar
|
||||
int status = success ? SPDK_BDEV_IO_STATUS_SUCCESS : SPDK_BDEV_IO_STATUS_FAILED;
|
||||
struct crypto_bdev_io *orig_ctx = (struct crypto_bdev_io *)orig_io->driver_ctx;
|
||||
|
||||
spdk_dma_free(orig_ctx->cry_iov.iov_base);
|
||||
spdk_free(orig_ctx->cry_iov.iov_base);
|
||||
spdk_bdev_io_complete(orig_io, status);
|
||||
spdk_bdev_free_io(bdev_io);
|
||||
}
|
||||
|
@ -439,7 +439,7 @@ test_simple_write(void)
|
||||
CU_ASSERT(g_test_crypto_ops[0]->sym->m_dst->buf_addr != NULL);
|
||||
CU_ASSERT(g_test_crypto_ops[0]->sym->m_dst->data_len == 512);
|
||||
|
||||
spdk_dma_free(g_io_ctx->cry_iov.iov_base);
|
||||
spdk_free(g_io_ctx->cry_iov.iov_base);
|
||||
spdk_mempool_put(g_mbuf_mp, g_test_crypto_ops[0]->sym->m_src);
|
||||
spdk_mempool_put(g_mbuf_mp, g_test_crypto_ops[0]->sym->m_dst);
|
||||
}
|
||||
@ -534,7 +534,7 @@ test_large_rw(void)
|
||||
spdk_mempool_put(g_mbuf_mp, g_test_crypto_ops[i]->sym->m_src);
|
||||
spdk_mempool_put(g_mbuf_mp, g_test_crypto_ops[i]->sym->m_dst);
|
||||
}
|
||||
spdk_dma_free(g_io_ctx->cry_iov.iov_base);
|
||||
spdk_free(g_io_ctx->cry_iov.iov_base);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -653,7 +653,7 @@ test_crazy_rw(void)
|
||||
spdk_mempool_put(g_mbuf_mp, g_test_crypto_ops[i]->sym->m_src);
|
||||
spdk_mempool_put(g_mbuf_mp, g_test_crypto_ops[i]->sym->m_dst);
|
||||
}
|
||||
spdk_dma_free(g_io_ctx->cry_iov.iov_base);
|
||||
spdk_free(g_io_ctx->cry_iov.iov_base);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -836,7 +836,8 @@ test_crypto_op_complete(void)
|
||||
g_completion_called = false;
|
||||
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);
|
||||
g_io_ctx->cry_iov.iov_base = spdk_malloc(16, 0x10, NULL, SPDK_ENV_LCORE_ID_ANY,
|
||||
SPDK_MALLOC_DMA);
|
||||
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);
|
||||
@ -849,7 +850,8 @@ 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, 0x40, NULL);
|
||||
g_io_ctx->cry_iov.iov_base = spdk_malloc(16, 0x40, NULL, SPDK_ENV_LCORE_ID_ANY,
|
||||
SPDK_MALLOC_DMA);
|
||||
/* To Do: remove this garbage assert as soon as scan-build stops throwing a
|
||||
* heap use after free error.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user