[lkml]   [2016]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[patch] dm: check for kmalloc failure in dm_init_request_based_blk_mq_queue()
We can just return -ENOMEM if the kzalloc() fails.

Fixes: 41b2facaf4ba ('dm: allocate blk_mq_tag_set rather than embed in mapped_device')
Signed-off-by: Dan Carpenter <>

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 6b7e80e..1a5f879 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -2736,6 +2736,8 @@ static int dm_init_request_based_blk_mq_queue(struct mapped_device *md,
int err;

md->tag_set = kzalloc(sizeof(struct blk_mq_tag_set), GFP_KERNEL);
+ if (!md->tag_set)
+ return -ENOMEM;
md->tag_set->ops = &dm_mq_ops;
md->tag_set->queue_depth = dm_get_blk_mq_queue_depth();
md->tag_set->numa_node = NUMA_NO_NODE;
 \ /
  Last update: 2016-02-09 12:41    [W:0.036 / U:10.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site