NVMe: Check for NULL memory in nvme_dev_add
authorKeith Busch <keith.busch@intel.com>
Wed, 1 May 2013 19:07:48 +0000 (13:07 -0600)
committerMatthew Wilcox <matthew.r.wilcox@intel.com>
Thu, 2 May 2013 18:35:44 +0000 (14:35 -0400)
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
drivers/block/nvme-core.c

index 388c54d..2d4f2ae 100644 (file)
@@ -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) {