Skip to content

Commit 62a9d9f

Browse files
yeyunfeng-devherbertx
authored andcommitted
crypto: hisilicon - Fix return value check in hisi_zip_acompress()
The return valude of add_comp_head() is int, but @head_size is size_t, which is a unsigned type. size_t head_size; ... if (head_size < 0) // it will never work return -ENOMEM Modify the type of @head_size to int, then change the type to size_t when invoke hisi_zip_create_req() as a parameter. Fixes: 62c455c ("crypto: hisilicon - add HiSilicon ZIP accelerator support") Signed-off-by: Yunfeng Ye <[email protected]> Acked-by: Zhou Wang <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent e00371a commit 62a9d9f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/crypto/hisilicon/zip/zip_crypto.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,15 +559,15 @@ static int hisi_zip_acompress(struct acomp_req *acomp_req)
559559
struct hisi_zip_ctx *ctx = crypto_tfm_ctx(acomp_req->base.tfm);
560560
struct hisi_zip_qp_ctx *qp_ctx = &ctx->qp_ctx[QPC_COMP];
561561
struct hisi_zip_req *req;
562-
size_t head_size;
562+
int head_size;
563563
int ret;
564564

565565
/* let's output compression head now */
566566
head_size = add_comp_head(acomp_req->dst, qp_ctx->qp->req_type);
567567
if (head_size < 0)
568568
return -ENOMEM;
569569

570-
req = hisi_zip_create_req(acomp_req, qp_ctx, head_size, true);
570+
req = hisi_zip_create_req(acomp_req, qp_ctx, (size_t)head_size, true);
571571
if (IS_ERR(req))
572572
return PTR_ERR(req);
573573

0 commit comments

Comments
 (0)