[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <342511df-d321-4a77-b76a-77f3844d7fa3@fujitsu.com>
Date: Mon, 19 Aug 2024 06:04:02 +0000
From: "Zhijian Li (Fujitsu)" <lizhijian@...itsu.com>
To: Dan Williams <dan.j.williams@...el.com>, "nvdimm@...ts.linux.dev"
<nvdimm@...ts.linux.dev>
CC: "vishal.l.verma@...el.com" <vishal.l.verma@...el.com>,
"dave.jiang@...el.com" <dave.jiang@...el.com>, "ira.weiny@...el.com"
<ira.weiny@...el.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 1/2] nvdimm: Fix devs leaks in scan_labels()
On 10/08/2024 06:55, Dan Williams wrote:
> Dan Williams wrote:
> [..]
>> @@ -2036,12 +2038,10 @@ static struct device **scan_labels(struct nd_region *nd_region)
>
> ...of course you would also need something like:
>
> if (!count) {
> kfree(devs);
> return NULL;
> }
It seems we don't need this cleanup, in the count=0 case, we would reach `err` to free devs.
Thanks
Zhijian
>
> ...here, I'll leave that to you to fix up and test.
>
>> return devs;
>>
>> err:
>> - if (devs) {
>> - for (i = 0; devs[i]; i++)
>> - namespace_pmem_release(devs[i]);
>> - kfree(devs);
>> - }
>> - return NULL;
>> + for (i = 0; devs[i]; i++)
>> + namespace_pmem_release(devs[i]);
>> + kfree(devs);
>> + return NULL;
>> }
>>
Powered by blists - more mailing lists