Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp209654pxf; Wed, 24 Mar 2021 03:16:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwy68yPpY985RjOXDAJasbEqWJZJCOiDTPlGiJGVXBXK2a76Z6XmrXJvyMyZ7wTBXLK277L X-Received: by 2002:a17:907:2bf6:: with SMTP id gv54mr2872163ejc.514.1616580999683; Wed, 24 Mar 2021 03:16:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616580999; cv=none; d=google.com; s=arc-20160816; b=ojY5Xv3xCXV3K4qze1vYap3eZkbX3KPrGQpeVoRae/heN2byXQlziMQxxjVtvIiv3F vXVSlPPrEVCDoosNubF8fP6DTn+Afir0Klq1wCrwTct9+zMb+n/dAhxqAGCTwqnuuFRF HJk8iOzuzYeYiRTIOiYwFT71j+N6CBKESgLRhCdukMxpXTaGsTVEjs/hDD//OsKLQ4Jn 6Z8Puo2bS/oiPwscPJpIiJY2uj9dkpnDRr159ZNndvjM+0UpLU93qWK/QcrS9GPfjdN1 2gJTZQ+FwS/wYMntosnRT+Ysu/b8QVmiqlvGjOUbKOeiyihiSdTabXpmXfM0tovcAqFU 0+Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=LknztGgqkN///91+7Wug8dejmfXPPMToN8QWuG2wkMU=; b=VpFpOMxaCWTa3MTpv4D6aPDwEnOJ+FSMaJ9ntCJisf1yo8KWV0KOoGRuDpi/j+NpWN Y+E78eOZBBctQoDu9XG4Euklg75H7VHJ79rSTF/qSurR1t8F667PztZJwhh/mAoQJpq3 joLdZv4X5exmfHWu7NFpG/O29cVSA3/b4gneCvTbXKDRdp0yz0vDWJIgFTt+sA+veEiz ZKaIq7Liz6Dl7k4Cq0UNyR7t//apmGicXlPD05xsurJjaYGJlqcfVu3k263ZneMjn9TV GrSv5fS1n12YnAmjzVFam87QW83GopnLIgoBHEG9O91r5Rx4+CmgUeBkudrvpM24+aNi LudA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dgAtPKFU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gh5si1488989ejb.479.2021.03.24.03.16.16; Wed, 24 Mar 2021 03:16:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dgAtPKFU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235689AbhCXHH4 (ORCPT + 99 others); Wed, 24 Mar 2021 03:07:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235692AbhCXHH3 (ORCPT ); Wed, 24 Mar 2021 03:07:29 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C98F2C061763; Wed, 24 Mar 2021 00:07:28 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id r10-20020a05600c35cab029010c946c95easo557930wmq.4; Wed, 24 Mar 2021 00:07:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LknztGgqkN///91+7Wug8dejmfXPPMToN8QWuG2wkMU=; b=dgAtPKFUuWUjQ37dOc0OLRQ0W9XnjH6AH5XU+e3dkmMhR8GOQCP+fNdliZAZiSlf9Q 6VULApcmccdCtUVHvey5bDGWLcozs2T2kLB5K0suVa6Rxk4KCMfdgQhtzsnLIyGAbzXy ccZ6FAg6rHsVUfTlG6/E7kTWzbnR+IQffaThyQH3U4k0Q8Wqkl1v31MMmFamw+HJ0Msy XA+77Z/l7ctIY7ZCK7Kz6xqZx2IvGq56aBKu8A4QXEYVwMI6bOszq4b0WLhFRhMV5HoI wt9+wjNbDoP6KBFVlhn/rAKoD5WQlQ3hfdVoGXHgpFlrNr2W6xiwR/5qEXCN7LxAv9DM dsiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LknztGgqkN///91+7Wug8dejmfXPPMToN8QWuG2wkMU=; b=ID3sI41Dk3JOkqzcR8RrlZTXcY65EzknE/4vFePnhbgbirVmeEAbx8PAzFfcnbBBGh HYeOz5VSvVMgVygaGg0p23V9wyLSiSVn3lcr/qi+SwzPOp2ActfuNRvS2O6akR/Wajli DeIa20/i/zqYNRewJ1y/NWN4s9KSz7ljfbMIXe02y55H48xpv67wqkA1If9WGPYdpF0N 3n8ezqEr4xKLoTEDIMJA07uNjS/n+xKEP4SoSqJsVkT6tLNwoXMMgKl/VXRAC5eceXR3 j+H4MdoWugvXg6Z341srE4nPNsRKpuP3SG15xx1Y07ktfOB5MY76k9JajYZ9rEUVsImh xJnw== X-Gm-Message-State: AOAM5319hDQeEjwbhzvWwRglHhwOQ5DBKcaG5vwEwiffsuvRF0zP8hrt jHJUa2rXjDBh4YTbZjNVeY3c1JlcEW276uKx+G3ESX7yYeM= X-Received: by 2002:a05:600c:47d7:: with SMTP id l23mr1421587wmo.155.1616569647596; Wed, 24 Mar 2021 00:07:27 -0700 (PDT) MIME-Version: 1.0 References: <20210323123245.346491-1-colin.king@canonical.com> In-Reply-To: <20210323123245.346491-1-colin.king@canonical.com> From: Sunil Kovvuri Date: Wed, 24 Mar 2021 12:37:15 +0530 Message-ID: Subject: Re: [PATCH] octeontx2-af: Fix memory leak of object buf To: Colin King Cc: Sunil Goutham , Linu Cherian , Geetha sowjanya , Jerin Jacob , hariprasad , Subbaraya Sundeep , "David S . Miller" , Jakub Kicinski , Rakesh Babu , Linux Netdev List , kernel-janitors@vger.kernel.org, LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 23, 2021 at 6:07 PM Colin King wrote: > > From: Colin Ian King > > Currently the error return path when lfs fails to allocate is not free'ing > the memory allocated to buf. Fix this by adding the missing kfree. > > Addresses-Coverity: ("Resource leak") > Fixes: f7884097141b ("octeontx2-af: Formatting debugfs entry rsrc_alloc.") > Signed-off-by: Colin Ian King > --- > drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c > index 8ec17ee72b5d..9bf8eaabf9ab 100644 > --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c > +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c > @@ -253,8 +253,10 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp, > return -ENOSPC; > > lfs = kzalloc(lf_str_size, GFP_KERNEL); > - if (!lfs) > + if (!lfs) { > + kfree(buf); > return -ENOMEM; > + } > off += scnprintf(&buf[off], buf_size - 1 - off, "%-*s", lf_str_size, > "pcifunc"); > for (index = 0; index < BLK_COUNT; index++) > -- > 2.30.2 > Thanks for the fix, Acked-by: Sunil Goutham