[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260126161839.GC1339236@e132581.arm.com>
Date: Mon, 26 Jan 2026 16:18:39 +0000
From: Leo Yan <leo.yan@....com>
To: Suzuki K Poulose <suzuki.poulose@....com>
Cc: Mike Leach <mike.leach@...aro.org>,
James Clark <james.clark@...aro.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Mao Jinlong <quic_jinlmao@...cinc.com>, coresight@...ts.linaro.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/8] coresight: Fix memory leak in
coresight_alloc_device_name()
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
Powered by blists - more mailing lists