powerpc: kmalloc failure ignored in vio_build_iommu_table()
authorroel kluin <roel.kluin@gmail.com>
Wed, 9 Sep 2009 05:02:24 +0000 (05:02 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 24 Sep 2009 05:31:38 +0000 (15:31 +1000)
Prevent NULL dereference if kmalloc() fails.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kernel/vio.c

index bc7b41edbdfce10671e942cc0857fdf9d022ea5e..1b4f674ad7c40632776dd32acaafd558b5767f96 100644 (file)
@@ -1054,6 +1054,8 @@ static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
                return NULL;
 
        tbl = kmalloc(sizeof(*tbl), GFP_KERNEL);
+       if (tbl == NULL)
+               return NULL;
 
        of_parse_dma_window(dev->dev.archdata.of_node, dma_window,
                            &tbl->it_index, &offset, &size);