Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp3775941ybe; Mon, 16 Sep 2019 00:39:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxswLc4QJx4g97Z0ojMhfx3RI/Ndj+Smnm1cRg03RQO7EfhKMdQo/NIdtYC/tgg/M8hP1Nq X-Received: by 2002:aa7:df14:: with SMTP id c20mr1555425edy.133.1568619563436; Mon, 16 Sep 2019 00:39:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568619563; cv=none; d=google.com; s=arc-20160816; b=UoRKmjfwlTRc+YPD5lsK1Z+ZWqoT3gTHUJxKfqdcoW+khtFRIRMtkBqK63AFal1Mh6 AkBaKbao8z9VE5vOYb0DZXstBuG1t+Xf6DH73UE6nkIAVRIFjpz9lKGqiEJoLMKu9Lyb Xrdn21LkyZ5SPd/9tmi4GjeNFyhl4sgpdjqeH+scokIigB3eyvl5OIbFq6vtdkul5Jsf tkoRPVZ7OtdLEHZZ6KqJZ1uEIur8k2QgSyiY3PF+szz+j5g2uR+T9QZUB+CHhEtPJWm5 L/UC7TA2oybpwlni5S1YgNogNxN4zr/h7eBGALQvBYJshya4mNkXud5UEUXdzGbv22Yb 3DIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:mime-version:user-agent:date:message-id:subject :from:cc:to; bh=/H102ZeL/W5uZLF2N8T/imsQstu22Dh5LznP/u/QjBs=; b=E7wcnhBNxQF0c/ZNjh0ybCF9JvI1U5rQmGi7tMiW5h000UctDDawMqFADrfXOub29d tWYXL55BGbg318Nv85cVrV32LKmSZIhT+GQ9sArGr0qxhl6pQQ1ZXO0GQ2+OwO5LQJdk z5F+RwnDnqb17/xe3tEOjNJkCLo/lKeTB+hYmSlt/NGZ7fr4k/wmGHE76cM+uLalcWzs DsEZv9Bb+b16bjwtvybqT9C/prdr6RiCC3FOqEcAbxbySVxLxOv4q2+CvJB1qOBSe01W 9BrN4AnnU37twAZ+i0GLUX+t66ajNeh5H7Jc2PxooC5Q57VDY3/95xqYCVwGNuWgAw21 smVg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r1si7059079eju.185.2019.09.16.00.38.59; Mon, 16 Sep 2019 00:39:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729903AbfIPGij (ORCPT + 99 others); Mon, 16 Sep 2019 02:38:39 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:51866 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729899AbfIPGij (ORCPT ); Mon, 16 Sep 2019 02:38:39 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 169298D72D382489D566; Mon, 16 Sep 2019 14:38:36 +0800 (CST) Received: from [127.0.0.1] (10.177.251.225) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.439.0; Mon, 16 Sep 2019 14:38:25 +0800 To: , , CC: , From: Yunfeng Ye Subject: [PATCH] crypto: hisilicon - Fix return value check in hisi_zip_acompress() Message-ID: <23be2eb5-8256-0c19-aef9-994974d11c9d@huawei.com> Date: Mon, 16 Sep 2019 14:38:25 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.251.225] X-CFilter-Loop: Reflected Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 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: 62c455ca853e ("crypto: hisilicon - add HiSilicon ZIP accelerator support") Signed-off-by: Yunfeng Ye --- drivers/crypto/hisilicon/zip/zip_crypto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/hisilicon/zip/zip_crypto.c b/drivers/crypto/hisilicon/zip/zip_crypto.c index 5a3f84d..5902354 100644 --- a/drivers/crypto/hisilicon/zip/zip_crypto.c +++ b/drivers/crypto/hisilicon/zip/zip_crypto.c @@ -559,7 +559,7 @@ static int hisi_zip_acompress(struct acomp_req *acomp_req) struct hisi_zip_ctx *ctx = crypto_tfm_ctx(acomp_req->base.tfm); struct hisi_zip_qp_ctx *qp_ctx = &ctx->qp_ctx[QPC_COMP]; struct hisi_zip_req *req; - size_t head_size; + int head_size; int ret; /* let's output compression head now */ @@ -567,7 +567,7 @@ static int hisi_zip_acompress(struct acomp_req *acomp_req) if (head_size < 0) return -ENOMEM; - req = hisi_zip_create_req(acomp_req, qp_ctx, head_size, true); + req = hisi_zip_create_req(acomp_req, qp_ctx, (size_t)head_size, true); if (IS_ERR(req)) return PTR_ERR(req); -- 2.7.4.huawei.3