[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cda9ab9b-4581-409f-a9bb-0e8a67ad3530@web.de>
Date: Wed, 14 Jan 2026 21:57:41 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: Zide Chen <zide.chen@...el.com>, linux-perf-users@...r.kernel.org,
Adrian Hunter <adrian.hunter@...el.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Andi Kleen <ak@...ux.intel.com>, Arnaldo Carvalho de Melo <acme@...nel.org>,
Dapeng Mi <dapeng1.mi@...ux.intel.com>, Ian Rogers <irogers@...gle.com>,
Ingo Molnar <mingo@...hat.com>, Peter Zijlstra <peterz@...radead.org>,
Namhyung Kim <namhyung@...nel.org>, Stephane Eranian <eranian@...gle.com>
Cc: lkp@...el.com, LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org, Thomas Falcon <thomas.falcon@...el.com>,
Xudong Hao <xudong.hao@...el.com>
Subject: Re: [PATCH V2] perf/x86/intel/uncore: Fix iounmap() leak on
global_init failure
> Kernel test robot reported:
Is this duplicate information according to a known tag?
> Unverified Error/Warning (likely false positive, kindly check if
> interested):
> arch/x86/events/intel/uncore_discovery.c:293:2-8:
> ERROR: missing iounmap; ioremap on line 288 and execution via
> conditional on line 292
See also:
https://elixir.bootlin.com/linux/v6.19-rc5/source/scripts/coccinelle/free/iounmap.cocci#L2-L8
> If domain->global_init() fails in __parse_discovery_table(), the
> ioremap'ed MMIO region is not released before returning, resulting
> in an MMIO mapping leak.
>
> Reported-by: kernel test robot <lkp@...el.com>
See also once more:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.19-rc5#n94
Will another imperative wording approach become helpful for an improved change description?
…
> ---
> arch/x86/events/intel/uncore_discovery.c | 15 ++++++++++-----
…
Some contributors would appreciate patch version descriptions.
https://lore.kernel.org/all/?q=%22This+looks+like+a+new+version+of+a+previously+submitted+patch%22
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.19-rc5#n310
Is there a need to perform desirable changes by a small patch series?
* Specific fix
* Related refinements
> +++ b/arch/x86/events/intel/uncore_discovery.c
> @@ -264,6 +264,7 @@ static int __parse_discovery_table(struct uncore_discovery_domain *domain,
> struct uncore_unit_discovery unit;
> void __iomem *io_addr;
> unsigned long size;
> + int ret = 0;
> int i;
Would scope adjustments become helpful for any of these local variables?
> @@ -273,21 +274,23 @@ static int __parse_discovery_table(struct uncore_discovery_domain *domain,
>
> /* Read Global Discovery State */
> memcpy_fromio(&global, io_addr, sizeof(struct uncore_global_discovery));
> + iounmap(io_addr);
> +
> if (uncore_discovery_invalid_unit(global)) {
…
> }
> - iounmap(io_addr);
Can this modification part be interpreted as an optimisation?
…
> - if (domain->global_init && domain->global_init(global.ctl))
> - return -ENODEV;
> + if (domain->global_init && domain->global_init(global.ctl)) {
> + ret = -ENODEV;
> + goto out;
> + }
…
> *parsed = true;
> +
> +out:
Would an other label be a bit clearer here?
unmap_io:
> iounmap(io_addr);
> - return 0;
> + return ret;
> }
…
Regards,
Markus
Powered by blists - more mailing lists