From: Mark Salter <msalter@redhat.com>
To: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
Khuong Dinh <khuong@os.amperecomputing.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] drivers/perf: xgene_pmu: Fix uninitialized resource struct
Date: Mon, 14 Sep 2020 09:13:39 -0400 [thread overview]
Message-ID: <f226e8f00f3f3a62b2b3367a8ddc03dd455bfa6c.camel@redhat.com> (raw)
In-Reply-To: <20200914112803.GA24312@willie-the-truck>
On Mon, 2020-09-14 at 12:28 +0100, Will Deacon wrote:
> On Sun, Sep 13, 2020 at 01:45:36PM -0400, Mark Salter wrote:
> > @@ -1483,11 +1473,23 @@ xgene_pmu_dev_ctx *acpi_get_pmu_hw_inf(struct xgene_pmu *xgene_pmu,
> > return NULL;
> >
> > INIT_LIST_HEAD(&resource_list);
> > - rc = acpi_dev_get_resources(adev, &resource_list,
> > - acpi_pmu_dev_add_resource, &res);
> > + rc = acpi_dev_get_resources(adev, &resource_list, NULL, NULL);
> > + if (rc <= 0) {
> > + dev_err(dev, "PMU type %d: No resources found\n", type);
> > + return NULL;
> > + }
> > +
> > + list_for_each_entry(rentry, &resource_list, node) {
> > + if (resource_type(rentry->res) == IORESOURCE_MEM) {
> > + res = *rentry->res;
> > + rentry = NULL;
> > + break;
> > + }
> > + }
> > acpi_dev_free_resource_list(&resource_list);
> > - if (rc < 0) {
> > - dev_err(dev, "PMU type %d: No resource address found\n", type);
> > +
> > + if (rentry) {
>
> I'm curious as to why you've had to change the failure logic here, setting
> rentry to NULL instead of checking 'rentry->res' like the TX2 driver (which
> I don't immediately understand at first glance).
>
> Will
>
I don't fully understand the tx2 logic. I do see there's a memory leak if
that (!rentry->res) is true. I was going to dig deeper and follow up with
a patch for tx2. I suspect that rentry->res should never be true. And tx2
won't detect if no memory resource is in the table.
Mark
next prev parent reply other threads:[~2020-09-14 13:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-13 17:45 Mark Salter
2020-09-14 11:28 ` Will Deacon
2020-09-14 13:13 ` Mark Salter [this message]
2020-09-14 13:59 ` Will Deacon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f226e8f00f3f3a62b2b3367a8ddc03dd455bfa6c.camel@redhat.com \
--to=msalter@redhat.com \
--cc=khuong@os.amperecomputing.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®