Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp608351ybe; Thu, 19 Sep 2019 00:28:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqxXclJifcwrQzVpS7QLDWcU4307HbXgv3mMTadvzaUhd8CsLJ6Wn9k+Rj8RUSw2F9sniNH4 X-Received: by 2002:a17:906:498c:: with SMTP id p12mr12897492eju.289.1568878124470; Thu, 19 Sep 2019 00:28:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568878124; cv=none; d=google.com; s=arc-20160816; b=Nb0zj/7TXMfv7SdXTcxvjlvl7Wu7X93/VmRhZnqWS+tOc8FYewhSlIldLhcFnLtHEp IGdA4bhP25uIxXRf1pF3eIK35A9UTwdH5OcrTzt6ciQCf0kN2gAbGNDdv83cvJ9QvCE/ EqhNzUJ0Z7wzZo/qc81gaLVSHx6Sa6W10ziNLZ7AMaVjoO8sx+dlugEg4DA3iPOx+Noy Rjp/YB6QR7QLIAFvBr1DjbCX7QXuVyS+p8R+Pc2eAoFqXl7/NkLcK1XyWJ/ReNlFTTPh IL/D1+fbIvtVF550qlbi2R1y9X71RaGzJmgPTSlZ5BYlTenjL3WOYUf1kDgJ4m1lE9TH cotA== 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:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=NmeZYHilB+rNDAdkXGnR/qe8Nekzf/PzkiYzMmCpxd4=; b=huYLhhcMpqr/Xvwe50GsMc9hMrrtUaR1fIC+no1bSyHbNf1RdoNLEDwJ42hSkT8E5H SGSEMzn3YOE3HSajkDCzBCrIOV4BB+r4MtlHwFYmfixrcTdPWmfiYgzgc548g+v2rj/4 3CWnjr/uJBFJ9284imq4/PtVIPRRJONXsQvUW7UfBPXe/4si86Azvn/ew1fwdnz+6kpM lT4xSfHjZ1W7GCr4+/XUF6L/pJksZ04Y5m3ZJDS+bo6mXD+mxVZm4ihAZL5X1ytR2bXK Ey+Zp6cGHEwWAzTtV8jcea/bMLhjr4XvJmzjKluC2N8ggDv2Y5IgFq/9oRI/5s5d/Gzq yA7A== 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 d11si4401743edx.137.2019.09.19.00.28.10; Thu, 19 Sep 2019 00:28:44 -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 S2387649AbfISGMm (ORCPT + 99 others); Thu, 19 Sep 2019 02:12:42 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:38634 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387646AbfISGMm (ORCPT ); Thu, 19 Sep 2019 02:12:42 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 28B1F52A7D8C5FEA9B88; Thu, 19 Sep 2019 14:12:40 +0800 (CST) Received: from [127.0.0.1] (10.63.139.185) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.439.0; Thu, 19 Sep 2019 14:12:29 +0800 Subject: Re: [PATCH] crypto: hisilicon - Fix return value check in hisi_zip_acompress() To: Yunfeng Ye , , References: <23be2eb5-8256-0c19-aef9-994974d11c9d@huawei.com> CC: , From: Zhou Wang Message-ID: <5D831C63.9020500@hisilicon.com> Date: Thu, 19 Sep 2019 14:12:51 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <23be2eb5-8256-0c19-aef9-994974d11c9d@huawei.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.63.139.185] X-CFilter-Loop: Reflected Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 2019/9/16 14:38, Yunfeng Ye wrote: > 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. Acked-by: Zhou Wang This is a bug, thinks for your fix! Best, Zhou > > 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); >