[PATCH] KVM: PPC: check for lookup_linux_ptep() returning NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If passed a larger page size lookup_linux_ptep()
may fail, so add a check for that and bail out
if that's the case.
This was found with the help of a static
code analysis tool.

Signed-off-by: Mihai Caraman <mihai.caraman@xxxxxxxxxxxxx>
Signed-off-by: Laurentiu Tudor <Laurentiu.Tudor@xxxxxxxxxxxxx>
Cc: Scott Wood <scottwood@xxxxxxxxxxxxx>
---
based on https://github.com/agraf/linux-2.6.git kvm-ppc-next

 arch/powerpc/kvm/e500_mmu_host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kvm/e500_mmu_host.c b/arch/powerpc/kvm/e500_mmu_host.c
index cc536d4..249c816 100644
--- a/arch/powerpc/kvm/e500_mmu_host.c
+++ b/arch/powerpc/kvm/e500_mmu_host.c
@@ -469,7 +469,7 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
 
 	pgdir = vcpu_e500->vcpu.arch.pgdir;
 	ptep = lookup_linux_ptep(pgdir, hva, &tsize_pages);
-	if (pte_present(*ptep))
+	if (ptep && pte_present(*ptep))
 		wimg = (*ptep >> PTE_WIMGE_SHIFT) & MAS2_WIMGE_MASK;
 	else {
 		if (printk_ratelimit())
-- 
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM Development]     [KVM ARM]     [KVM ia64]     [Linux Virtualization]     [Linux USB Devel]     [Linux Video]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux