[Accel-config] [PATCH 5/8] add protection src buffer for iaa scan
"Guo, Lingyan" <[email protected]> Fri, 27 Oct 2023 11:06:52 +0800
| Newsgroups | dev.linux.lists.accel-config |
|---|---|
| Message-ID | <[email protected]> |
From: lingyan <[email protected]> change: init scan input buffer and copy to src1 src1 will be overwrite by compress result Signed-off-by: lingyan <[email protected]> --- test/iaa.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/test/iaa.c b/test/iaa.c index a83877a..3256cde 100644 --- a/test/iaa.c +++ b/test/iaa.c @@ -305,11 +305,19 @@ static int init_scan(struct task *tsk, int tflags, tsk->test_flags = tflags; tsk->xfer_size = src1_xfer_size; + // Enough space for Chain decompress result + tsk->input = aligned_alloc(ADDR_ALIGNMENT, src1_xfer_size); + if (!tsk->input) + return -ENOMEM; + for (i = 0; i < (src1_xfer_size / 4); i++) + ((uint32_t *)tsk->input)[i] = pattern++; + tsk->src1 = aligned_alloc(ADDR_ALIGNMENT, src1_xfer_size); if (!tsk->src1) return -ENOMEM; - for (i = 0; i < (src1_xfer_size / 4); i++) - ((uint32_t *)tsk->src1)[i] = pattern++; + memset_pattern(tsk->src1, 0, src1_xfer_size); + memcpy(tsk->src1, tsk->input, src1_xfer_size); + tsk->src2 = aligned_alloc(32, IAA_FILTER_AECS_SIZE); if (!tsk->src2) @@ -2489,8 +2497,8 @@ int task_result_verify_scan(struct task *tsk, int mismatch_expected) if (mismatch_expected) warn("invalid arg mismatch_expected for %d\n", tsk->opcode); - - expected_len = iaa_do_scan(tsk->output, tsk->src1, tsk->src2, + // input , src2 unchange for w/wo chaining + expected_len = iaa_do_scan(tsk->output, tsk->input, tsk->src2, tsk->iaa_num_inputs, tsk->iaa_filter_flags); rc = memcmp(tsk->dst1, tsk->output, expected_len); -- 2.34.1