Merge tag 'for-linus-20180623' of git://git.kernel.dk/linux-block
[muen/linux.git] / drivers / block / null_blk.c
index 3d8bdbe9bd357334d642a6b251aa1276e0eb2c70..042c778e5a4e0bf2009c38a6b1cf37bc5d23ce89 100644 (file)
@@ -1575,12 +1575,12 @@ static int setup_commands(struct nullb_queue *nq)
        struct nullb_cmd *cmd;
        int i, tag_size;
 
-       nq->cmds = kzalloc(nq->queue_depth * sizeof(*cmd), GFP_KERNEL);
+       nq->cmds = kcalloc(nq->queue_depth, sizeof(*cmd), GFP_KERNEL);
        if (!nq->cmds)
                return -ENOMEM;
 
        tag_size = ALIGN(nq->queue_depth, BITS_PER_LONG) / BITS_PER_LONG;
-       nq->tag_map = kzalloc(tag_size * sizeof(unsigned long), GFP_KERNEL);
+       nq->tag_map = kcalloc(tag_size, sizeof(unsigned long), GFP_KERNEL);
        if (!nq->tag_map) {
                kfree(nq->cmds);
                return -ENOMEM;
@@ -1598,8 +1598,9 @@ static int setup_commands(struct nullb_queue *nq)
 
 static int setup_queues(struct nullb *nullb)
 {
-       nullb->queues = kzalloc(nullb->dev->submit_queues *
-               sizeof(struct nullb_queue), GFP_KERNEL);
+       nullb->queues = kcalloc(nullb->dev->submit_queues,
+                               sizeof(struct nullb_queue),
+                               GFP_KERNEL);
        if (!nullb->queues)
                return -ENOMEM;