From: Ira Weiny <ira.weiny@intel.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: dan.j.williams@intel.com, vishal.l.verma@intel.com,
dave.jiang@intel.com, nvdimm@lists.linux.dev,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] nvdimm/pmem: Fix an error handling path in 'pmem_attach_disk()'
Date: Sun, 7 Nov 2021 09:11:57 -0800 [thread overview]
Message-ID: <20211107171157.GC3538886@iweiny-DESK2.sc.intel.com> (raw)
In-Reply-To: <f1933a01d9cefe24970ee93d741babb8fe9c1b32.1636219557.git.christophe.jaillet@wanadoo.fr>
On Sat, Nov 06, 2021 at 06:27:11PM +0100, Christophe JAILLET wrote:
> If 'devm_init_badblocks()' fails, a previous 'blk_alloc_disk()' call must
> be undone.
I think this is a problem...
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> This patch is speculative. Several fixes on error handling paths have been
> done recently, but this one has been left as-is. There was maybe a good
> reason that I have missed for that. So review with care!
>
> I've not been able to identify a Fixes tag that please me :(
> ---
> drivers/nvdimm/pmem.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
> index fe7ece1534e1..c37a1e6750b3 100644
> --- a/drivers/nvdimm/pmem.c
> +++ b/drivers/nvdimm/pmem.c
> @@ -490,8 +490,9 @@ static int pmem_attach_disk(struct device *dev,
> nvdimm_namespace_disk_name(ndns, disk->disk_name);
> set_capacity(disk, (pmem->size - pmem->pfn_pad - pmem->data_offset)
> / 512);
> - if (devm_init_badblocks(dev, &pmem->bb))
> - return -ENOMEM;
> + rc = devm_init_badblocks(dev, &pmem->bb);
> + if (rc)
> + goto out;
But I don't see this 'out' label in the function currently? Was that part of
your patch missing?
Ira
> nvdimm_badblocks_populate(nd_region, &pmem->bb, &bb_range);
> disk->bb = &pmem->bb;
>
> --
> 2.30.2
>
next prev parent reply other threads:[~2021-11-07 17:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-06 17:27 Christophe JAILLET
2021-11-07 17:11 ` Ira Weiny [this message]
2021-11-07 17:20 ` Christophe JAILLET
2021-11-07 17:25 ` Marion & Christophe JAILLET
2021-11-07 18:14 ` Marion & Christophe JAILLET
2021-11-08 16:14 ` Ira Weiny
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=20211107171157.GC3538886@iweiny-DESK2.sc.intel.com \
--to=ira.weiny@intel.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=kernel-janitors@vger.kernel.org \
--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®