From a9ef4343afbe67a6abf83c0f0294e80db48e513a Mon Sep 17 00:00:00 2001 From: Keith Busch Date: Wed, 1 May 2013 13:07:48 -0600 Subject: [PATCH] NVMe: Check for NULL memory in nvme_dev_add Signed-off-by: Keith Busch Signed-off-by: Matthew Wilcox --- drivers/block/nvme-core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index 388c54d84809..2d4f2ae36d31 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c @@ -1527,6 +1527,8 @@ static int nvme_dev_add(struct nvme_dev *dev) mem = dma_alloc_coherent(&dev->pci_dev->dev, 8192, &dma_addr, GFP_KERNEL); + if (!mem) + return -ENOMEM; res = nvme_identify(dev, 0, 1, dma_addr); if (res) {