2021-06-09 12:40:22

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: build warning after merge of the block tree

Hi all,

After merging the block tree, today's linux-next build (powerpc
ppc64_defconfig) produced this warning:

drivers/nvdimm/pmem.c: In function 'pmem_pagemap_cleanup':
drivers/nvdimm/pmem.c:338:24: warning: unused variable 'q' [-Wunused-variable]
338 | struct request_queue *q =
| ^

Introduced by commit

80b58f4e9f4a ("libnvdimm/pmem: Fix blk_cleanup_disk() usage")

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2021-06-09 17:06:21

by Dan Williams

[permalink] [raw]
Subject: Re: linux-next: build warning after merge of the block tree

On Tue, Jun 8, 2021 at 8:52 PM Stephen Rothwell <[email protected]> wrote:
>
> Hi all,
>
> After merging the block tree, today's linux-next build (powerpc
> ppc64_defconfig) produced this warning:
>
> drivers/nvdimm/pmem.c: In function 'pmem_pagemap_cleanup':
> drivers/nvdimm/pmem.c:338:24: warning: unused variable 'q' [-Wunused-variable]
> 338 | struct request_queue *q =
> | ^
>

Ugh, I should have caught this... fix incoming.

> Introduced by commit
>
> 80b58f4e9f4a ("libnvdimm/pmem: Fix blk_cleanup_disk() usage")
>
> --
> Cheers,
> Stephen Rothwell

2021-06-09 17:08:08

by Dan Williams

[permalink] [raw]
Subject: [PATCH] libnvdimm/pmem: Fix pmem_pagemap_cleanup compile warning

The recent fix to pmem_pagemap_cleanup() to solve a NULL pointer
dereference with the queue_to_disk() helper neglected to remove the @q
variable when queue_to_disk() was replaced.

Drop the conversion of @pgmap to its containing 'struct request_queue'
since pgmap->owner supersedes the need to reference @q.

Reported-by: Stephen Rothwell <[email protected]>
Fixes: 80b58f4e9f4a ("libnvdimm/pmem: Fix blk_cleanup_disk() usage")
Signed-off-by: Dan Williams <[email protected]>
---
drivers/nvdimm/pmem.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index fc6b78dd2d24..1e0615b8565e 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -335,8 +335,6 @@ static const struct attribute_group *pmem_attribute_groups[] = {

static void pmem_pagemap_cleanup(struct dev_pagemap *pgmap)
{
- struct request_queue *q =
- container_of(pgmap->ref, struct request_queue, q_usage_counter);
struct pmem_device *pmem = pgmap->owner;

blk_cleanup_disk(pmem->disk);