mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Zhijian Li (Fujitsu)" <lizhijian@fujitsu.com>
To: Dan Williams <dan.j.williams@intel.com>,
	"nvdimm@lists.linux.dev" <nvdimm@lists.linux.dev>
Cc: "vishal.l.verma@intel.com" <vishal.l.verma@intel.com>,
	"dave.jiang@intel.com" <dave.jiang@intel.com>,
	"ira.weiny@intel.com" <ira.weiny@intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] nvdimm: Fix devs leaks in scan_labels()
Date: Mon, 19 Aug 2024 06:04:02 +0000	[thread overview]
Message-ID: <342511df-d321-4a77-b76a-77f3844d7fa3@fujitsu.com> (raw)
In-Reply-To: <66b69e681ea7a_25752943c@dwillia2-xfh.jf.intel.com.notmuch>



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;
>>   }
>>   

  reply	other threads:[~2024-08-19  6:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-19  1:58 Li Zhijian
2024-07-19  1:58 ` [PATCH v2 2/2] nvdimm: Remove dead code for ENODEV checking " Li Zhijian
2024-07-26 13:37 ` [PATCH v2 1/2] nvdimm: Fix devs leaks " Ira Weiny
2024-07-29  2:32   ` Zhijian Li (Fujitsu)
2024-08-09 22:38 ` Dan Williams
2024-08-09 22:55   ` Dan Williams
2024-08-19  6:04     ` Zhijian Li (Fujitsu) [this message]
2024-08-19  3:45   ` Zhijian Li (Fujitsu)

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=342511df-d321-4a77-b76a-77f3844d7fa3@fujitsu.com \
    --to=lizhijian@fujitsu.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nvdimm@lists.linux.dev \
    --cc=vishal.l.verma@intel.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®