mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 14:42:37 +02:00
powerpc/iommu: Avoid derefence before pointer check
[ Upstream commit 984ecdd68d ]
The tbl pointer is being derefenced by IOMMU_PAGE_SIZE prior the check
if it is not NULL.
Just moving the dereference code to after the check, where there will
be guarantee that 'tbl' will not be NULL.
Signed-off-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
13d5bc50f4
commit
089b169ceb
|
|
@ -785,9 +785,9 @@ dma_addr_t iommu_map_page(struct device *dev, struct iommu_table *tbl,
|
|||
|
||||
vaddr = page_address(page) + offset;
|
||||
uaddr = (unsigned long)vaddr;
|
||||
npages = iommu_num_pages(uaddr, size, IOMMU_PAGE_SIZE(tbl));
|
||||
|
||||
if (tbl) {
|
||||
npages = iommu_num_pages(uaddr, size, IOMMU_PAGE_SIZE(tbl));
|
||||
align = 0;
|
||||
if (tbl->it_page_shift < PAGE_SHIFT && size >= PAGE_SIZE &&
|
||||
((unsigned long)vaddr & ~PAGE_MASK) == 0)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user