main_loop() reads test_data->window_sz before checking whether test_data
is NULL. Move the window size calculation after the check.

Fixes: 568815516e88 ("app/compress-perf: support dictionaries and PDCP 
checksum")
Cc: [email protected]

Signed-off-by: Oleg Kotkov <[email protected]>
---
 app/test-compress-perf/comp_perf_test_verify.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/app/test-compress-perf/comp_perf_test_verify.c 
b/app/test-compress-perf/comp_perf_test_verify.c
index 66425d7e3c..353743d145 100644
--- a/app/test-compress-perf/comp_perf_test_verify.c
+++ b/app/test-compress-perf/comp_perf_test_verify.c
@@ -65,7 +65,7 @@ main_loop(struct cperf_verify_ctx *ctx, enum 
rte_comp_xform_type type)
        int allocated = 0;
        uint32_t out_seg_sz;
        uint8_t dict[MAX_DICT_SIZE] = {0};
-       uint16_t window_size = (1ULL << test_data->window_sz);
+       uint16_t window_size;
        uint8_t *udc_header = NULL;
 
        if (test_data == NULL || !test_data->burst_sz) {
@@ -74,6 +74,8 @@ main_loop(struct cperf_verify_ctx *ctx, enum 
rte_comp_xform_type type)
                return -1;
        }
 
+       window_size = (1ULL << test_data->window_sz);
+
        if (test_data->dictionary_data) {
                if (test_data->dictionary_data_sz >= window_size) {
                        memcpy(dict,
-- 
2.43.0

Reply via email to