From patchwork Tue Aug 2 10:34:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 1028792 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p72AadcB023155 for ; Tue, 2 Aug 2011 10:36:39 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753271Ab1HBKfS (ORCPT ); Tue, 2 Aug 2011 06:35:18 -0400 Received: from mgw2.diku.dk ([130.225.96.92]:59084 "EHLO mgw2.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753154Ab1HBKfM (ORCPT ); Tue, 2 Aug 2011 06:35:12 -0400 Received: from localhost (localhost [127.0.0.1]) by mgw2.diku.dk (Postfix) with ESMTP id B4BFB19BC29; Tue, 2 Aug 2011 12:35:10 +0200 (CEST) Received: from mgw2.diku.dk ([127.0.0.1]) by localhost (mgw2.diku.dk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 23797-16; Tue, 2 Aug 2011 12:35:04 +0200 (CEST) Received: from palace.topps.diku.dk (palace.ekstranet.diku.dk [192.38.115.202]) by mgw2.diku.dk (Postfix) with ESMTP id C52F719BC2E; Tue, 2 Aug 2011 12:35:04 +0200 (CEST) From: Julia Lawall To: Avi Kivity , trivial@kernel.org Cc: kernel-janitors@vger.kernel.org, Marcelo Tosatti , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/11] arch/x86/kvm/vmx.c: trivial: use BUG_ON Date: Tue, 2 Aug 2011 12:34:57 +0200 Message-Id: <1312281304-11847-5-git-send-email-julia@diku.dk> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1312281304-11847-1-git-send-email-julia@diku.dk> References: <1312281304-11847-1-git-send-email-julia@diku.dk> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 02 Aug 2011 10:37:05 +0000 (UTC) From: Julia Lawall Use BUG_ON(x) rather than if(x) BUG(); The semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier x; @@ -if (x) BUG(); +BUG_ON(x); @@ identifier x; @@ -if (!x) BUG(); +BUG_ON(!x); // Signed-off-by: Julia Lawall --- arch/x86/kvm/vmx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff -u -p a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -4115,8 +4115,7 @@ static int handle_exception(struct kvm_v error_code = vmcs_read32(VM_EXIT_INTR_ERROR_CODE); if (is_page_fault(intr_info)) { /* EPT won't cause page fault directly */ - if (enable_ept) - BUG(); + BUG_ON(enable_ept); cr2 = vmcs_readl(EXIT_QUALIFICATION); trace_kvm_page_fault(cr2, error_code);