kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: PPC: check for lookup_linux_ptep() returning NULL
@ 2015-05-21 13:26 Laurentiu Tudor
  2015-05-21 19:37 ` Scott Wood
  0 siblings, 1 reply; 3+ messages in thread
From: Laurentiu Tudor @ 2015-05-21 13:26 UTC (permalink / raw)
  To: kvm-ppc, Alexander Graf; +Cc: Laurentiu Tudor, Mihai Caraman, Scott Wood, kvm

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@freescale.com>
Signed-off-by: Laurentiu Tudor <Laurentiu.Tudor@freescale.com>
Cc: Scott Wood <scottwood@freescale.com>
---
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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-25 21:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-21 13:26 [PATCH] KVM: PPC: check for lookup_linux_ptep() returning NULL Laurentiu Tudor
2015-05-21 19:37 ` Scott Wood
2015-05-25 21:01   ` Alexander Graf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).