mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeff Moyer <jmoyer@redhat.com>
To: jaxboe@fusionio.com, linux-kernel@vger.kernel.org
Subject: [patch] blk-mq: zero out ctx_map during initialization
Date: Mon, 21 Oct 2013 13:57:19 -0400	[thread overview]
Message-ID: <x491u3ecxs0.fsf@segfault.boston.devel.redhat.com> (raw)

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;

             reply	other threads:[~2013-10-21 17:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-21 17:57 Jeff Moyer [this message]
2013-10-21 19:12 ` Jens Axboe

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=x491u3ecxs0.fsf@segfault.boston.devel.redhat.com \
    --to=jmoyer@redhat.com \
    --cc=jaxboe@fusionio.com \
    --cc=linux-kernel@vger.kernel.org \
    /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®