From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CE955CD98C5 for ; Mon, 15 Jun 2026 08:56:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+15dwgnble0wCZ3JagfnDOLZonAyeju8TDWIimrYT0w=; b=FbIictwGRJrv083U96aBFbYdI8 OzHKHut/KI/E49O/ACW8931BKsWy0qMHIBqVOb/Axr2PMjJBP/K5iZ19TBHd7mixaWCEsDCQZXNkc z/vgbp0BfR/VhzILlHiCWdwSmQLGN3izFhFW76wG8atAT8P+Egv/9xSDGIgulaxnprMLS36uQdz/h op7qkUXcpxGK14al+9Xf6K45Pw9Nvc5rilZmCpY5dTUmj1JaYM7b7tLz13QvbcY3tJvlrBg7CWTqw aG8vdHs5RwpxhzEL4vl3bjc32cR4igTjYWpjP7tqXMFdNItmuiJsbarUA9xE0UnbQXt6a+Aa8OuNN zD9oLv7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wZ36t-0000000DvBr-3TTU; Mon, 15 Jun 2026 08:55:59 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wZ36r-0000000DvBl-2L4a for linux-arm-kernel@lists.infradead.org; Mon, 15 Jun 2026 08:55:58 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id BFE5F6008A; Mon, 15 Jun 2026 08:55:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77FB71F000E9; Mon, 15 Jun 2026 08:55:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1781513756; bh=+15dwgnble0wCZ3JagfnDOLZonAyeju8TDWIimrYT0w=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=n3bhxGIX8J1DdwFwUDhrCGujpIClQzLcEkO5YGPMG8+AT/+vKjonbb9n/fiNtnTHl fwRVZIotEdHlBB9C5v6lc569QCD3mvMRQZ8+na/PJGPRhPKef/cdt/c3yitqyXup7z B5g3uJ40f8Vb7886QZfysf0pKoolE+1H7xCkeWICmH9QBHoPCGU6jTIkpiyDfXRnAK 5Cf7YZTdfW+u2XUBkHh70KGAS9dZeLpx75JMiBk44A/yMysn2z+e0tpTzymdZcR4+6 ixWzYYucsZFeCR5pWL7/CiEmIfIIe+M0V+OEzbZrwhdBjBwRIftCmFwI9QXXQ4/GFV JuZeYYyMWALhw== Received: from sofa.misterjones.org ([185.219.108.64] helo=lobster-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wZ36o-0000000CrnC-1oPX; Mon, 15 Jun 2026 08:55:54 +0000 Date: Mon, 15 Jun 2026 09:59:14 +0100 Message-ID: <87ik7k89i5.wl-maz@kernel.org> From: Marc Zyngier To: Kemeng Shi Cc: tglx@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/6] irqchip/gic-v3-its: Fix memleak in its_probe_one() In-Reply-To: <20260615032910.54735-3-shikemeng@huaweicloud.com> References: <20260615032910.54735-1-shikemeng@huaweicloud.com> <20260615032910.54735-3-shikemeng@huaweicloud.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: shikemeng@huaweicloud.com, tglx@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 15 Jun 2026 04:29:06 +0100, Kemeng Shi wrote: > > Fix collection leak when its_init_domain() failed in its_probe_one(). > > Signed-off-by: Kemeng Shi > --- > drivers/irqchip/irq-gic-v3-its.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c > index 2b7b546c43c8..df26ddc97ae2 100644 > --- a/drivers/irqchip/irq-gic-v3-its.c > +++ b/drivers/irqchip/irq-gic-v3-its.c > @@ -3032,6 +3032,12 @@ static int its_alloc_collections(struct its_node *its) > return 0; > } > > +static void its_free_collections(struct its_node *its) > +{ > + kfree(its->collections); > + its->collections = NULL; > +} Why do we need an extra helper for something that has a single calling spot? Why is it important to set collections to NULL, given that we're about to free the structure without even looking further? M. -- Jazz isn't dead. It just smells funny.