From patchwork Wed Feb 5 19:58:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 24230 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f72.google.com (mail-qa0-f72.google.com [209.85.216.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F0166202B2 for ; Wed, 5 Feb 2014 20:02:42 +0000 (UTC) Received: by mail-qa0-f72.google.com with SMTP id f11sf1604553qae.11 for ; Wed, 05 Feb 2014 12:02:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :mime-version:cc:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=dy5uR6v5eYF5Tv1ce58mSluNjHUyX0K3odwdNj+aVIk=; b=FJpmWq6YzDaNXnWtxcQxDEbqepjrvwzVCS4FvIZE5PEkLOHaXlDiEAe8aBdA0QizuJ YY40FwDUcZIQdzlJLTyDAIbX7JCllbaZ46vGwSiwnrtbx5oLGaJ22Nunbp7eR3Mh3J8m kHg3j0IJ+L/N0RBrTOUcTECUOKLL8s+tLG5UXN3696wQjW1J/teRXiAZC+a+EnYADaDP LO++3xKHiXiuOI4QfOiXz/A/WdzD+RYd4b2paufzqjgiMwlOsoDMOq+mT/eikVZ6ps4u XerFzlM5ojz8MWjzQEmYryq3Kw90NcizPaGZhh7z43pNppHfSKDQU82LiVzuv0SYSBVB vj3A== X-Gm-Message-State: ALoCoQlxxtkuKbo2zNG90mqHm7f2at87GYPdjTuNgURXTw1Msptvwq2buHDCo8H/JOVcwhhrDfgl X-Received: by 10.224.49.72 with SMTP id u8mr1455094qaf.3.1391630562149; Wed, 05 Feb 2014 12:02:42 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.36.7 with SMTP id o7ls265432qgo.15.gmail; Wed, 05 Feb 2014 12:02:42 -0800 (PST) X-Received: by 10.52.232.168 with SMTP id tp8mr1881863vdc.38.1391630562067; Wed, 05 Feb 2014 12:02:42 -0800 (PST) Received: from mail-vb0-f44.google.com (mail-vb0-f44.google.com [209.85.212.44]) by mx.google.com with ESMTPS id gq1si9982869vec.137.2014.02.05.12.02.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 05 Feb 2014 12:02:42 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.44 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.44; Received: by mail-vb0-f44.google.com with SMTP id f12so686290vbg.31 for ; Wed, 05 Feb 2014 12:02:42 -0800 (PST) X-Received: by 10.52.27.9 with SMTP id p9mr1897778vdg.28.1391630561956; Wed, 05 Feb 2014 12:02:41 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp82065vcz; Wed, 5 Feb 2014 12:02:41 -0800 (PST) X-Received: by 10.194.58.132 with SMTP id r4mr2669710wjq.45.1391630560811; Wed, 05 Feb 2014 12:02:40 -0800 (PST) Received: from casper.infradead.org (casper.infradead.org. [2001:770:15f::2]) by mx.google.com with ESMTPS id wa6si365058wjc.50.2014.02.05.12.02.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Feb 2014 12:02:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:770:15f::2 as permitted sender) client-ip=2001:770:15f::2; Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WB8eB-0007Vm-CZ; Wed, 05 Feb 2014 20:00:38 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WB8cU-0007xZ-Tn; Wed, 05 Feb 2014 19:58:50 +0000 Received: from fw-tnat.austin.arm.com ([217.140.110.23] helo=collaborate-mta1.arm.com) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WB8cR-0007uQ-Kj for linux-arm-kernel@lists.infradead.org; Wed, 05 Feb 2014 19:58:48 +0000 Received: from e102391-lin.cambridge.arm.com (e102391-lin.cambridge.arm.com [10.1.209.166]) by collaborate-mta1.arm.com (Postfix) with ESMTP id E7EDF13F61D; Wed, 5 Feb 2014 13:58:25 -0600 (CST) From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Subject: [PATCH] ARM: KVM: fix warning in mmu.c Date: Wed, 5 Feb 2014 19:58:25 +0000 Message-Id: <1391630305-8056-1-git-send-email-marc.zyngier@arm.com> X-Mailer: git-send-email 1.8.3.4 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140205_145847_752606_A9859C1B X-CRM114-Status: GOOD ( 11.21 ) X-Spam-Score: -2.4 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.5 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Christoffer Dall X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: marc.zyngier@arm.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.44 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Compiling with THP enabled leads to the following warning: arch/arm/kvm/mmu.c: In function ‘unmap_range’: arch/arm/kvm/mmu.c:177:39: warning: ‘pte’ may be used uninitialized in this function [-Wmaybe-uninitialized] if (kvm_pmd_huge(*pmd) || page_empty(pte)) { ^ Code inspection reveals that these two cases are mutually exclusive, so GCC is a bit overzealous here. But silence it anyway by setting pte to NULL if kvm_pmd_huge(*pmd) is true. Signed-off-by: Marc Zyngier --- arch/arm/kvm/mmu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c index ea21b6a..3020221 100644 --- a/arch/arm/kvm/mmu.c +++ b/arch/arm/kvm/mmu.c @@ -169,12 +169,14 @@ static void unmap_range(struct kvm *kvm, pgd_t *pgdp, pte = pte_offset_kernel(pmd, addr); clear_pte_entry(kvm, pte, addr); next = addr + PAGE_SIZE; + } else { + pte = NULL; } /* * If the pmd entry is to be cleared, walk back up the ladder */ - if (kvm_pmd_huge(*pmd) || page_empty(pte)) { + if (kvm_pmd_huge(*pmd) || (pte && page_empty(pte))) { clear_pmd_entry(kvm, pmd, addr); next = pmd_addr_end(addr, end); if (page_empty(pmd) && !page_empty(pud)) {