Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp3962838rdb; Mon, 11 Dec 2023 05:20:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IGIcLxQ3aQGMmjlg5NcPTc4mrpiJSh0DnWqSmOICuteehFp7vpxQHtcGKrMi5jtT36Ex8v+ X-Received: by 2002:a17:902:b708:b0:1d0:cae6:eea1 with SMTP id d8-20020a170902b70800b001d0cae6eea1mr4093561pls.83.1702300821993; Mon, 11 Dec 2023 05:20:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702300821; cv=none; d=google.com; s=arc-20160816; b=rDDWVZXJ0OBWgB+qq35BMbMqdEbMqmEVyUkeR8i2v5kiMLlzkr0v6rhSqNfJbJD1id 8mINlSIzi8i9cfp9a3mQiHnzhyfOz/Ey2hPJ4omR9L4aeNDJbX6broA2CjrelmT3cnb6 440q99ua1PVJ0G75afXwbCQ2jjossQIOy+3pAnAljs4iCNpnTqO5IGeoyVsQ6BjzJIj7 Rpc6eZiSpnNpaf7QhSuadBh+IJIkKMwE573m5CKXVNrsZI6sqeezKVKxGgD/uOela2x3 u6Dxy6cohhgNQ2H8+pcU8InloCF9rtT/An4WOTLwbF8h3Jyr3nkLWe9AOOL/Y2YkQ2sG /lZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rs9qcdc/1uyum7egN/jLUF2Ye3Y5tkYhvbDNyJdI6O0=; fh=ZAqfFMGFB253Xs6ccHz2mpZpR4sifygYTJJJ4ONNm3s=; b=cLl1BbcGbkrJF9p9cDWxlP2UsEAxY9UdYYQWFRzdrY2f08sZ5C5JZ8+0P3J9T8BVey bZrAMp9WT6kK9DWVAa86SXeN/RuLHq1nLOlO7XzPHLC0dWbigE/2i+jT03t/9FrQy7H2 zrarWDzwC4AYcAodA10RsDYuyFRcSu/VsvSUbXQW299dy24NVgbWedYTJszmHxPBKbWI r8s8M27WyfCJKDmnbCKARVitUsU8Lt15zn54X93UD8jZK9E5hvlvjmfMax+5MqiXytzQ /77hFWXix63/J4CKFN5hmqH4yli/G1x9h+8PW6X5W9WDFuJtsWyISggKP3cZ+wMWCQdP xIsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=niDr1jyM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id d4-20020a170902b70400b001cfcf3dd310si6042382pls.505.2023.12.11.05.20.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 05:20:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=niDr1jyM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 704CA8065EF4; Mon, 11 Dec 2023 05:20:19 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343615AbjLKNUE (ORCPT + 99 others); Mon, 11 Dec 2023 08:20:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234350AbjLKNUD (ORCPT ); Mon, 11 Dec 2023 08:20:03 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A7939F; Mon, 11 Dec 2023 05:20:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1702300810; x=1733836810; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=aWWmxlxn0pM8okQkL2E4L7uqb6CIH81faOxCrpqcrJA=; b=niDr1jyMnM8fxPIExSw0MLoYWMgZ1bP5Z1DdDrwGsvKwsrQoUY6kwt/h Dzvv7QAS2sYbU5gwtmtApf5MwXFGUwSMB1aQ1qsI3BG4fV55pIJAQpiHz /lMRNTVH9/zA3N6N4CNmf8Pl57zmeMbn7bFRvEaJr+pdAhUnrhzmF3uC8 NudGdn6lbMBcwmQlWEZfSarIClLCcWS5KaRc2/9t3Hm/ob0LS5ejpMPlG y5WbJ7hKyl0p0YnJNojWisD413RQfAi8llM/9vlKEdtJ3f1QM3Y/FpgAi C+9uxf5P+2roclkO5toj7IG6cNSIZa4YXNSq766DFJb0Yg6nk+e/W+EsY A==; X-CSE-ConnectionGUID: gPfR+rluR3a0j2IyXO7vGQ== X-CSE-MsgGUID: YZcXyw1DSgOOmSXR8rHP3w== X-ThreatScanner-Verdict: Negative X-IronPort-AV: E=Sophos;i="6.04,267,1695711600"; d="asc'?scan'208";a="180278630" X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 11 Dec 2023 06:20:09 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 11 Dec 2023 06:19:48 -0700 Received: from wendy (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 11 Dec 2023 06:19:47 -0700 Date: Mon, 11 Dec 2023 13:19:17 +0000 From: Conor Dooley To: Kuan-Wei Chiu CC: , , , , Subject: Re: [PATCH] clk: mmp: pxa168: Fix memory leak in pxa168_clk_init() Message-ID: <20231211-urgent-carol-45ca352a9d2a@wendy> References: <20231210175232.3414584-1-visitorckw@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="vwICD4jSZexuFxQq" Content-Disposition: inline In-Reply-To: <20231210175232.3414584-1-visitorckw@gmail.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 11 Dec 2023 05:20:19 -0800 (PST) --vwICD4jSZexuFxQq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Dec 11, 2023 at 01:52:32AM +0800, Kuan-Wei Chiu wrote: > In cases where mapping of mpmu/apmu/apbc registers fails, the code path > does not handle the failure gracefully, potentially leading to a memory > leak. This fix ensures proper cleanup by freeing the allocated memory > for 'pxa_unit' before returning. >=20 > Signed-off-by: Kuan-Wei Chiu I dunno why you have CCed me on this tbh, I guess I must have acked a patch related to this driver's bindings somehow. I wonder, is there actually any point in freeing these, isn't the system going to fail to actually boot if these allocations fail? > --- > drivers/clk/mmp/clk-of-pxa168.c | 3 +++ > 1 file changed, 3 insertions(+) >=20 > diff --git a/drivers/clk/mmp/clk-of-pxa168.c b/drivers/clk/mmp/clk-of-pxa= 168.c > index fb0df64cf053..c5a7ba1deaa3 100644 > --- a/drivers/clk/mmp/clk-of-pxa168.c > +++ b/drivers/clk/mmp/clk-of-pxa168.c > @@ -308,18 +308,21 @@ static void __init pxa168_clk_init(struct device_no= de *np) > pxa_unit->mpmu_base =3D of_iomap(np, 0); > if (!pxa_unit->mpmu_base) { > pr_err("failed to map mpmu registers\n"); > + kfree(pxa_unit); > return; > } > =20 > pxa_unit->apmu_base =3D of_iomap(np, 1); > if (!pxa_unit->apmu_base) { > pr_err("failed to map apmu registers\n"); > + kfree(pxa_unit); > return; > } > =20 > pxa_unit->apbc_base =3D of_iomap(np, 2); > if (!pxa_unit->apbc_base) { > pr_err("failed to map apbc registers\n"); > + kfree(pxa_unit); > return; > } > =20 > --=20 > 2.25.1 >=20 --vwICD4jSZexuFxQq Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZXcMVAAKCRB4tDGHoIJi 0npnAQDhMi0sOhFCb2XK8e4LHbB01fNeeAnX29yOGRmSBgkI6QD/RL448S6rMuJr psmgLu7PXSxRaa4u79WAnL996jASxQY= =0YJF -----END PGP SIGNATURE----- --vwICD4jSZexuFxQq--