mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Leo Yan <leo.yan@arm.com>
To: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>,
	James Clark <james.clark@linaro.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Mao Jinlong <quic_jinlmao@quicinc.com>,
	coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/8] coresight: Fix memory leak in coresight_alloc_device_name()
Date: Mon, 26 Jan 2026 16:18:39 +0000	[thread overview]
Message-ID: <20260126161839.GC1339236@e132581.arm.com> (raw)
In-Reply-To: <062c51c2-082d-4771-83df-3e5bfa90927d@arm.com>

Hi Suzuki,

On Mon, Jan 26, 2026 at 03:48:28PM +0000, Suzuki K Poulose wrote:

[...]

> > @@ -1546,7 +1546,7 @@ char *coresight_alloc_device_name(struct coresight_dev_list *dict,
> >   	if (idx < 0) {
> >   		/* Make space for the new entry */
> >   		idx = dict->nr_idx;
> > -		list = krealloc_array(dict->fwnode_list,
> > +		list = devm_krealloc_array(dev, dict->fwnode_list,
> >   				      idx + 1, sizeof(*dict->fwnode_list),
> 
> This is wrong. This would mean, the array gets released when the "dev" goes
> away and thats not good. This is a per-driver list, not a per-device list.
> Also, please remember that, we need to keep that node alive
> when the device goes away, to make sure to allocate the same device name
> when if/it comes back.  May be, you could release the  list and array, when
> the "driver" goes away.

Indeed.  In next spin, I will to fix the leak in module exit.

Thanks for pointing this out.

Leo

  reply	other threads:[~2026-01-26 16:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-26 13:52 [PATCH v2 0/8] coresight: Fix device registration and unregistration Leo Yan
2026-01-26 13:52 ` [PATCH v2 1/8] coresight: Fix memory leak in coresight_alloc_device_name() Leo Yan
2026-01-26 15:48   ` Suzuki K Poulose
2026-01-26 16:18     ` Leo Yan [this message]
2026-01-26 13:52 ` [PATCH v2 2/8] coresight: Get parent device reference after sink ID map allocation Leo Yan
2026-01-26 13:52 ` [PATCH v2 3/8] coresight: Protect unregistration with mutex Leo Yan
2026-01-26 13:52 ` [PATCH v2 4/8] coresight: Refactor output connection sysfs link cleanup Leo Yan
2026-01-26 13:52 ` [PATCH v2 5/8] coresight: Refactor sysfs connection group cleanup Leo Yan
2026-01-26 13:52 ` [PATCH v2 6/8] coresight: Move sink validation into etm_perf_add_symlink_sink() Leo Yan
2026-01-26 13:52 ` [PATCH v2 7/8] coresight: Do not mix success path with failure handling Leo Yan
2026-01-26 13:52 ` [PATCH v2 8/8] coresight: Unify error handling in coresight_register() Leo Yan

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=20260126161839.GC1339236@e132581.arm.com \
    --to=leo.yan@arm.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=coresight@lists.linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=james.clark@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=mike.leach@linaro.org \
    --cc=quic_jinlmao@quicinc.com \
    --cc=suzuki.poulose@arm.com \
    /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®