提交 efca4885 编写于 作者: D Dan Carpenter 提交者: David S. Miller

sparc64: move dereference after check for NULL

We shouldn't dereference "iommu" until after we have checked that it is
non-NULL.

Fixes: f08978b0 ("sparc64: Enable sun4v dma ops to use IOMMU v2 APIs")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 b1ebb975
......@@ -478,11 +478,10 @@ static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist,
BUG_ON(direction == DMA_NONE);
iommu = dev->archdata.iommu;
atu = iommu->atu;
if (nelems == 0 || !iommu)
return 0;
atu = iommu->atu;
prot = HV_PCI_MAP_ATTR_READ;
if (direction != DMA_TO_DEVICE)
prot |= HV_PCI_MAP_ATTR_WRITE;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册