mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Dan Williams <dan.j.williams@intel.com>,
	Li Zhijian <lizhijian@fujitsu.com>, <nvdimm@lists.linux.dev>
Cc: <dan.j.williams@intel.com>, <vishal.l.verma@intel.com>,
	<dave.jiang@intel.com>, <ira.weiny@intel.com>,
	<linux-kernel@vger.kernel.org>,
	Li Zhijian <lizhijian@fujitsu.com>
Subject: Re: [PATCH v2 1/2] nvdimm: Fix devs leaks in scan_labels()
Date: Fri, 9 Aug 2024 15:55:36 -0700	[thread overview]
Message-ID: <66b69e681ea7a_25752943c@dwillia2-xfh.jf.intel.com.notmuch> (raw)
In-Reply-To: <66b69a6fc5710_257529458@dwillia2-xfh.jf.intel.com.notmuch>

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

...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-09 22:55 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 [this message]
2024-08-19  6:04     ` Zhijian Li (Fujitsu)
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=66b69e681ea7a_25752943c@dwillia2-xfh.jf.intel.com.notmuch \
    --to=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizhijian@fujitsu.com \
    --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®