
From: Chenghai Huang <huangchenghai2@huawei.com> When wd_do_comp_strm returns error ret, status in req is not updated to that in strm_req. As a result, when the internal status of strm_req is WD_IN_EPARA, the req obtained by the user is not WD_IN_EPARA. Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com> Signed-off-by: Qi Tao <taoqi10@huawei.com> --- drv/hisi_comp.c | 8 ++++---- wd_comp.c | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drv/hisi_comp.c b/drv/hisi_comp.c index 71e859f5..1e55094b 100644 --- a/drv/hisi_comp.c +++ b/drv/hisi_comp.c @@ -340,7 +340,7 @@ static void fill_buf_sgl_skip(struct hisi_zip_sqe *sqe, __u32 src_skip, sqe->dw8 = val; } -static int fill_buf_deflate_slg_generic(handle_t h_qp, struct hisi_zip_sqe *sqe, +static int fill_buf_deflate_sgl_generic(handle_t h_qp, struct hisi_zip_sqe *sqe, struct wd_comp_msg *msg, const char *head, int head_size) { @@ -376,19 +376,19 @@ static int fill_buf_deflate_slg_generic(handle_t h_qp, struct hisi_zip_sqe *sqe, static int fill_buf_deflate_sgl(handle_t h_qp, struct hisi_zip_sqe *sqe, struct wd_comp_msg *msg) { - return fill_buf_deflate_slg_generic(h_qp, sqe, msg, NULL, 0); + return fill_buf_deflate_sgl_generic(h_qp, sqe, msg, NULL, 0); } static int fill_buf_zlib_sgl(handle_t h_qp, struct hisi_zip_sqe *sqe, struct wd_comp_msg *msg) { - return fill_buf_deflate_slg_generic(h_qp, sqe, msg, ZLIB_HEADER, ZLIB_HEADER_SZ); + return fill_buf_deflate_sgl_generic(h_qp, sqe, msg, ZLIB_HEADER, ZLIB_HEADER_SZ); } static int fill_buf_gzip_sgl(handle_t h_qp, struct hisi_zip_sqe *sqe, struct wd_comp_msg *msg) { - return fill_buf_deflate_slg_generic(h_qp, sqe, msg, GZIP_HEADER, GZIP_HEADER_SZ); + return fill_buf_deflate_sgl_generic(h_qp, sqe, msg, GZIP_HEADER, GZIP_HEADER_SZ); } static void fill_buf_size_lz77_zstd(struct hisi_zip_sqe *sqe, __u32 in_size, diff --git a/wd_comp.c b/wd_comp.c index 4768642a..e7246740 100644 --- a/wd_comp.c +++ b/wd_comp.c @@ -688,6 +688,10 @@ int wd_do_comp_sync2(handle_t h_sess, struct wd_comp_req *req) ret = wd_do_comp_strm(h_sess, &strm_req); if (unlikely(ret < 0 || strm_req.status == WD_IN_EPARA)) { + req->status = strm_req.status; + if (!ret) + ret = -WD_EINVAL; + WD_ERR("wd comp, invalid or incomplete data! ret = %d, status = %u!\n", ret, strm_req.status); return ret; @@ -784,7 +788,7 @@ static void wd_do_comp_strm_end_check(struct wd_comp_sess *sess, int wd_do_comp_strm(handle_t h_sess, struct wd_comp_req *req) { struct wd_comp_sess *sess = (struct wd_comp_sess *)h_sess; - struct wd_comp_msg msg; + struct wd_comp_msg msg = {0}; __u32 src_len; int ret; -- 2.33.0