
From: Chenghai Huang <huangchenghai2@huawei.com> Check whether the pointer is null before the ctx_buf is reset. Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com> Signed-off-by: Qi Tao <taoqi10@huawei.com> --- drv/hisi_comp.c | 4 ++++ wd_comp.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drv/hisi_comp.c b/drv/hisi_comp.c index 645b2bc8..7a106652 100644 --- a/drv/hisi_comp.c +++ b/drv/hisi_comp.c @@ -856,6 +856,10 @@ static int fill_comp_level_lz77_zstd(struct hisi_zip_sqe *sqe, enum wd_comp_leve switch (comp_lv) { case WD_COMP_L8: + /* + * L8 indicates that the price mode is disabled. + * By default, the price mode is disabled. + */ break; case WD_COMP_L9: val = sqe->dw9 & ~HZ_REQ_TYPE_MASK; diff --git a/wd_comp.c b/wd_comp.c index 02863df6..ca8faa39 100644 --- a/wd_comp.c +++ b/wd_comp.c @@ -502,7 +502,9 @@ int wd_comp_reset_sess(handle_t h_sess) } sess->stream_pos = WD_COMP_STREAM_NEW; - memset(sess->ctx_buf, 0, HW_CTX_SIZE); + + if (sess->ctx_buf) + memset(sess->ctx_buf, 0, HW_CTX_SIZE); return 0; } -- 2.33.0