Le 07/11/2021 à 18:25, Marion & Christophe JAILLET a écrit :
Le 07/11/2021 à 18:20, Christophe JAILLET a écrit :
Le 07/11/2021 à 18:11, Ira Weiny a écrit :
On Sat, Nov 06, 2021 at 06:27:11PM +0100, Christophe JAILLET wrote:
If 'devm_init_badblocks()' fails, a previous 'blk_alloc_disk()' call
I think this is a problem...
Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr>
This patch is speculative. Several fixes on error handling paths
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
@@ -490,8 +490,9 @@ static int pmem_attach_disk(struct device *dev,
set_capacity(disk, (pmem->size - pmem->pfn_pad -
- 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
your patch missing?
the patch is based on the latest linux-next.
See . The 'out' label exists there and is already used.
In fact, I run an own-made coccinelle script which tries to spot
mix-up between return and goto.
In this case, we have a 'return -ENOMEM' after a 'goto out' which
looks spurious. Hence, my patch.
Lol, the #n512 above is in fact another place that should be updated as
well. I missed it and only fixed #n494!
In fact, no, line 512 should be left as-is. The clean-up wilol be made
The patch attached at the very first mail of this thread looks good to me.
nvdimm_badblocks_populate(nd_region, &pmem->bb, &bb_range);
disk->bb = &pmem->bb;