Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0f337274 authored by roel kluin's avatar roel kluin Committed by Benjamin Herrenschmidt
Browse files

powerpc: kmalloc failure ignored in vio_build_iommu_table()



Prevent NULL dereference if kmalloc() fails.

Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 254be490
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -1054,6 +1054,8 @@ static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
		return NULL;
		return NULL;


	tbl = kmalloc(sizeof(*tbl), GFP_KERNEL);
	tbl = kmalloc(sizeof(*tbl), GFP_KERNEL);
	if (tbl == NULL)
		return NULL;


	of_parse_dma_window(dev->dev.archdata.of_node, dma_window,
	of_parse_dma_window(dev->dev.archdata.of_node, dma_window,
			    &tbl->it_index, &offset, &size);
			    &tbl->it_index, &offset, &size);