Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp553633ybl; Thu, 15 Aug 2019 23:48:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqx4L+GVEFxRp7jOmlDX/b3VXWGKIvk95MFlRhlpn6hPkNEj4bEPT6Dya+1Ee0YB8mjslFbI X-Received: by 2002:a63:481c:: with SMTP id v28mr6446854pga.50.1565938102966; Thu, 15 Aug 2019 23:48:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565938102; cv=none; d=google.com; s=arc-20160816; b=q6g5L5ZPcFru8kGQ0CGFDyV7k42Ldws8NoEJERvn68wrrgj/8WoW14DVn0Rrujx7jJ 4J+mb7Koc185Bhf2GZSJe+JXx6J/h8QxMvWdJbq6+5FTKiIKjpKA2PZMaQ+UQwN8nXLF yb7Eg9CEr0cTtS4cE60yFBoqQ3FpSClyMjdhD+HE/yVIEdxWiBZMqlJsSorMu1q3FuaY W//VbujbtyMHcHf6oh4eWMgqP5EO/5k34EjU75vLC/OALmiIP//wFMIDTZe+VXAVqm08 yOgNeKz2HTgBlE/0E+CQc8zOvv5xaZih7JbBa693+n/nmGIcwjhtNFdkFaUsNs3KMZle v7Jw== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=8ejrG7Ga8fIC/cJrzSfBTC0lZHdgt0SWvgyJaXWmYs0=; b=PrahRHsDf5xTT+EZnrvR2guBq+JDkdlOApihfPmC/78eiHoP5wuKKDa5cw7v8h3OkP a36sjPbZZTNrnZsEQx8ReNeF799Wb9B5/lZ6xuUG9dmC7EQN8iHub8mxlyOfTeBvmBgq D/wl6sUylRs9+fB9GX+mSqqAVAxL7NLN+mi9iCdCEQExFnVNcsy5O/glNLzEvdXAA9y8 bnUNMYYO1C3KRVMQPavPnCaVdn2kCAoZnZvjfO95nTloVC0e5B9kG/AcWvtwfXMNWdpd WfhCPkt2xP960Kw01/1QC3QJKG7wf9cxwD7NM2a55aa/fvEs0KEkL+9kNoIAx43JJE2a PdsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 v23si3236037pgn.557.2019.08.15.23.48.07; Thu, 15 Aug 2019 23:48:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726866AbfHPGqK convert rfc822-to-8bit (ORCPT + 99 others); Fri, 16 Aug 2019 02:46:10 -0400 Received: from ajax.cs.uga.edu ([128.192.4.6]:37036 "EHLO ajax.cs.uga.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725945AbfHPGqJ (ORCPT ); Fri, 16 Aug 2019 02:46:09 -0400 Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (authenticated bits=0) by ajax.cs.uga.edu (8.14.4/8.14.4) with ESMTP id x7G6k6pN009281 (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 16 Aug 2019 02:46:08 -0400 Received: by mail-lj1-f176.google.com with SMTP id z17so4399867ljz.0; Thu, 15 Aug 2019 23:46:07 -0700 (PDT) X-Gm-Message-State: APjAAAXU+xsv5iWCf0J6nXJxyWFJqG9P2pMuefQplCDajAN3QI5JxbMj KirCYl7CcIVicVOaC2DpuCInZAvQ7wU1MF4tojg= X-Received: by 2002:a2e:7c12:: with SMTP id x18mr4759455ljc.100.1565937966576; Thu, 15 Aug 2019 23:46:06 -0700 (PDT) MIME-Version: 1.0 References: <1565936603-7046-1-git-send-email-wenwen@cs.uga.edu> In-Reply-To: From: Wenwen Wang Date: Fri, 16 Aug 2019 02:45:29 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] dmaengine: ti: Fix a memory leak bug To: Peter Ujfalusi Cc: Dan Williams , Vinod Koul , Enrico Weigelt , Greg Kroah-Hartman , Thomas Gleixner , Kate Stewart , "open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM" , open list , Wenwen Wang Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 16, 2019 at 2:42 AM Peter Ujfalusi wrote: > > > > On 16/08/2019 9.23, Wenwen Wang wrote: > > In ti_dra7_xbar_probe(), 'rsv_events' is allocated through kcalloc(). Then > > of_property_read_u32_array() is invoked to search for the property. > > However, if this process fails, 'rsv_events' is not deallocated, leading to > > a memory leak bug. To fix this issue, free 'rsv_events' before returning > > the error. > > Can you change the subject to: > "dmaengine: ti: dma-crossbar: Fix a memory leak bug" ? No problem. I will rework the patch. Thanks for your suggestion! Wenwen > > Otherwise: Thank you, and > Acked-by: Peter Ujfalusi > > > > > Signed-off-by: Wenwen Wang > > --- > > drivers/dma/ti/dma-crossbar.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/dma/ti/dma-crossbar.c b/drivers/dma/ti/dma-crossbar.c > > index ad2f0a4..f255056 100644 > > --- a/drivers/dma/ti/dma-crossbar.c > > +++ b/drivers/dma/ti/dma-crossbar.c > > @@ -391,8 +391,10 @@ static int ti_dra7_xbar_probe(struct platform_device *pdev) > > > > ret = of_property_read_u32_array(node, pname, (u32 *)rsv_events, > > nelm * 2); > > - if (ret) > > + if (ret) { > > + kfree(rsv_events); > > return ret; > > + } > > > > for (i = 0; i < nelm; i++) { > > ti_dra7_xbar_reserve(rsv_events[i][0], rsv_events[i][1], > > > > - Péter > > Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. > Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki