From mboxrd@z Thu Jan 1 00:00:00 1970 From: Laurentiu Tudor Subject: [PATCH] KVM: PPC: check for lookup_linux_ptep() returning NULL Date: Thu, 21 May 2015 16:26:59 +0300 Message-ID: <555DDD23.1010903@freescale.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Cc: Laurentiu Tudor , Mihai Caraman , Scott Wood , To: , Alexander Graf Return-path: Sender: kvm-ppc-owner@vger.kernel.org List-Id: kvm.vger.kernel.org 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 Signed-off-by: Laurentiu Tudor Cc: Scott Wood --- 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