public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] blk-mq: zero out ctx_map during initialization
@ 2013-10-21 17:57 Jeff Moyer
  2013-10-21 19:12 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Moyer @ 2013-10-21 17:57 UTC (permalink / raw)
  To: jaxboe, linux-kernel

Hi,

ctx_map may contain random garbage, leading to (potentially chronic but
harmless) false positives in blk_mq_hctx_has_pending.

Note: I have not observed this in practice, just by code inspection.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 923e9e1..e9be5ed 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1197,7 +1197,7 @@ static int blk_mq_init_hw_queues(struct request_queue *q,
 			break;
 
 		num_maps = ALIGN(nr_cpu_ids, BITS_PER_LONG) / BITS_PER_LONG;
-		hctx->ctx_map = kmalloc_node(num_maps * sizeof(unsigned long),
+		hctx->ctx_map = kzalloc_node(num_maps * sizeof(unsigned long),
 						GFP_KERNEL, node);
 		if (!hctx->ctx_map)
 			break;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] blk-mq: zero out ctx_map during initialization
  2013-10-21 17:57 [patch] blk-mq: zero out ctx_map during initialization Jeff Moyer
@ 2013-10-21 19:12 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2013-10-21 19:12 UTC (permalink / raw)
  To: Jeff Moyer; +Cc: linux-kernel

On Mon, Oct 21 2013, Jeff Moyer wrote:
> Hi,
> 
> ctx_map may contain random garbage, leading to (potentially chronic but
> harmless) false positives in blk_mq_hctx_has_pending.
> 
> Note: I have not observed this in practice, just by code inspection.

It's the prudent thing to do in any case. Applied.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-21 19:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-21 17:57 [patch] blk-mq: zero out ctx_map during initialization Jeff Moyer
2013-10-21 19:12 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox