Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1569292pxk; Thu, 10 Sep 2020 20:28:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAxrlqrFmByZMpyxk4KCeMntU96jkKyoMZS2OY63StXXzkzAOIHpj6CwbPtvGlzxRZNG7N X-Received: by 2002:a50:a418:: with SMTP id u24mr12853998edb.103.1599794928472; Thu, 10 Sep 2020 20:28:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599794928; cv=none; d=google.com; s=arc-20160816; b=eEhIirDxfbdZKCIjUiEsANMNwjueXnMqDWz8erOTcXNb4kiOI8SFz67yrCcoAUYV7Z HtgvAtYcDXxOCOTKl7VMl2vix2xnRut9R9pc6MAMdZQ4SSaKo9+jIg7P2pPBN46cS4gt oZx7SgebhslsNy84AI+GbECWc3SbHsoUgtGzF0OWlwRDL92F6RcY508nChxgwnas5L3x dSawFnqbmas4vUaeBUv2g7cNnl2uprp2Qv+8iIkzGtY77px2/HCFnOSAjeSLc937TWKY zIsOB22yoAwCXnlvPfE4UKaA+aijFpe4P+IujVazY3rZRGrXu073cqNHTHuZz7j/lmhd SsNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=RA9KFoJp3PqISwzUKqgsR5Ov5kyz3ffV+2x+gaZzexg=; b=Cvm64Yi5kvrPJHjkE8T5vxzQuQVWMEE6qBMgXK7qKZsSZ4aAXl7qDaY0twCpnimJ9Z eMWHE92ncPZIWdCEEliajBSaucRupP2DkHnmKn06lOYtBgP8cXFt8K+5hXpuxBXqPDiq axtX5pQYTc9NY2sCLGGd/Jf6DkMA614WURixXjW/YJjl47e2NIniPg0ggFRs+4yePYdj sSx5ZdermrczDVofG4258fqAdNKomUo0b5VMHDUFPHs19VLnhM1vG9AtWTz8P+gpv/vm SEE9LQmKx2XCaKkoKDXczWUoEA8RxC/kKdyLOUwOV8MMizEEfqFXMUHEUZkfMFTPuwpI Enyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l10si407349edr.220.2020.09.10.20.28.13; Thu, 10 Sep 2020 20:28:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725355AbgIKD0q (ORCPT + 99 others); Thu, 10 Sep 2020 23:26:46 -0400 Received: from helcar.hmeau.com ([216.24.177.18]:58406 "EHLO fornost.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725857AbgIKD0q (ORCPT ); Thu, 10 Sep 2020 23:26:46 -0400 Received: from gwarestrin.arnor.me.apana.org.au ([192.168.0.7]) by fornost.hmeau.com with smtp (Exim 4.92 #5 (Debian)) id 1kGZhP-0005PW-Tx; Fri, 11 Sep 2020 13:26:09 +1000 Received: by gwarestrin.arnor.me.apana.org.au (sSMTP sendmail emulation); Fri, 11 Sep 2020 13:26:07 +1000 Date: Fri, 11 Sep 2020 13:26:07 +1000 From: Herbert Xu To: Xiaoliang Pang Cc: davem@davemloft.net, matthias.bgg@gmail.com, swboyd@chromium.org, yuehaibing@huawei.com, tianjia.zhang@linux.alibaba.com, ryder.lee@mediatek.com, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] cypto: mediatek - fix leaks in mtk_desc_ring_alloc Message-ID: <20200911032607.GA5096@gondor.apana.org.au> References: <20200911013619.9809-1-dawning.pang@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200911013619.9809-1-dawning.pang@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Fri, Sep 11, 2020 at 09:36:19AM +0800, Xiaoliang Pang wrote: > > diff --git a/drivers/crypto/mediatek/mtk-platform.c b/drivers/crypto/mediatek/mtk-platform.c > index 7e3ad085b5bd..ebb3bdef0dbe 100644 > --- a/drivers/crypto/mediatek/mtk-platform.c > +++ b/drivers/crypto/mediatek/mtk-platform.c > @@ -469,13 +469,13 @@ static int mtk_desc_ring_alloc(struct mtk_cryp *cryp) > return 0; > > err_cleanup: > - for (; i--; ) { > + do { > dma_free_coherent(cryp->dev, MTK_DESC_RING_SZ, > ring[i]->res_base, ring[i]->res_dma); > dma_free_coherent(cryp->dev, MTK_DESC_RING_SZ, > ring[i]->cmd_base, ring[i]->cmd_dma); > kfree(ring[i]); > - } > + }while(i--); Please add spaces before and after while. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt