From: Laurentiu Tudor <b10716@freescale.com>
To: kvm-ppc@vger.kernel.org, Alexander Graf <agraf@suse.de>
Cc: Laurentiu Tudor <Laurentiu.Tudor@freescale.com>,
Mihai Caraman <mihai.caraman@freescale.com>,
Scott Wood <scottwood@freescale.com>,
kvm@vger.kernel.org
Subject: [PATCH] KVM: PPC: check for lookup_linux_ptep() returning NULL
Date: Thu, 21 May 2015 13:26:59 +0000 [thread overview]
Message-ID: <555DDD23.1010903@freescale.com> (raw)
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
next reply other threads:[~2015-05-21 13:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-21 13:26 Laurentiu Tudor [this message]
2015-05-21 19:37 ` [PATCH] KVM: PPC: check for lookup_linux_ptep() returning NULL Scott Wood
2015-05-25 21:01 ` Alexander Graf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=555DDD23.1010903@freescale.com \
--to=b10716@freescale.com \
--cc=Laurentiu.Tudor@freescale.com \
--cc=agraf@suse.de \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=mihai.caraman@freescale.com \
--cc=scottwood@freescale.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox