powerpc/iommu: Avoid derefence before pointer check
authorBreno Leitao <leitao@debian.org>
Tue, 21 Aug 2018 18:44:48 +0000 (15:44 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Nov 2019 14:54:00 +0000 (15:54 +0100)
commit6eb5dfdd45645da7a023fea95865dab51a4f1a39
tree43ae655d70d580fb860ad5d6fba67804a184cc1b
parent3b767de18989f8f13bbd3d944b791674a8a1416d
powerpc/iommu: Avoid derefence before pointer check

[ Upstream commit 984ecdd68de0fa1f63ce205d6c19ef5a7bc67b40 ]

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>
arch/powerpc/kernel/iommu.c