Received: by 10.223.185.116 with SMTP id b49csp4285657wrg; Mon, 26 Feb 2018 14:47:37 -0800 (PST) X-Google-Smtp-Source: AH8x227T1F6xWaXoYDE3E8BRjKuq+zkDnCCjTk9gVsS8Djg1/cO4nxXWSPdaZLT2QCck/rMUa4rR X-Received: by 2002:a17:902:6782:: with SMTP id g2-v6mr12274949plk.19.1519685257073; Mon, 26 Feb 2018 14:47:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519685257; cv=none; d=google.com; s=arc-20160816; b=sV4/r+MPb0BxljOranqbWtber2KFApVuggCz6PiHpVKrLtwKB6FzpnVaksRlCVB7SV Qg3dzkweNYpw4LaQygfvPym4ST6lLm/yaciDbIGx7fKhE9P0vJ+5rYZUojdN6ZoLCRuP /VXAC+5Ckh1zA/1S6gHqMM2ga7Z710df3dF0siyB1AWZslqPNVnF65i5iIwjdv5F02N0 r6OC5Z0t88PBSC0aoMS9vK1xApoPIYpdi3JX9MJ1Wm4E9oGacat6CQtFGN2PbXIStFkp SL+JBkDvlEasvPyVkRn4iI1USbxDFZ4h9YtEngRZ9u6NkiX/RAABWI6fynzR2tjHpiKK A+ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=Fto/D0cr7YcrEW631lABD38bI/u8Fcg0nNr7Pc9Pyyg=; b=Szry5AijtFH3MG3vmJpkO7sHt0Fmhb2k56khFAbdDZujvoiWNxBi+aSr+6ui9JuXUX ILFK9R2U3ZAe4rAlmJNBBMUqUuVdnfcfqDPgw6UpM3CPGKQq4lNWnQXdc7UZT6gL9F1U dnDdqiFFmW2Za45wCh32BwglCjKlSlRnkDCAf/KOjin3yc9LrWorigH9oJttLxQgIfiM XlfmaPH/6wpRURlg5r0x1T3Z6iqfQdgT1e6uUH7vnN+NTmtZGTb9tgtRZ5d+3krgVhnR P+6wA9RdAV7pTnD7yg0+DD2jRgFY5E1saGNqJVk/oXllwJolAV0EJ6WpBIfKPatJPxfI BcNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=VDx+Njoz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si7465567plw.164.2018.02.26.14.47.20; Mon, 26 Feb 2018 14:47:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=VDx+Njoz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751668AbeBZWqZ (ORCPT + 99 others); Mon, 26 Feb 2018 17:46:25 -0500 Received: from mail-io0-f194.google.com ([209.85.223.194]:43440 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751245AbeBZWqX (ORCPT ); Mon, 26 Feb 2018 17:46:23 -0500 Received: by mail-io0-f194.google.com with SMTP id l12so19035420ioc.10 for ; Mon, 26 Feb 2018 14:46:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Fto/D0cr7YcrEW631lABD38bI/u8Fcg0nNr7Pc9Pyyg=; b=VDx+Njoz6JCoY3WNdIpwHZvXJKScPgf2gMIZv8kDd2SdWpBnfBgpmSEFwArosB+oAD VPWnLG0T3fdtyeSutyuVhgU4bAIiuLt5i4ZFb7Cg2483qn/GFqo4yvf/ZPnC3v/2QYsy 3XHxqvbEQJYBt2Z7tjnouSWkitUx1wPToVpTXmK3BjIKYKcxCn+0s68c5vfUOH331tLr OFyB/4CSe1I4Zy8hcHCxWzlaHDFuOV1n3mBl51Rpv6EDu3P5fCbtyG8XoFIHvAav9Rz2 E+7UKdzjVIrM1SV3MA10NBqAmBvHMjwd8RbSubYSf8adanFPpkd3GjJ71xJVExq120lu f1ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Fto/D0cr7YcrEW631lABD38bI/u8Fcg0nNr7Pc9Pyyg=; b=OKuwlExcRGOpP71GA7T2CeIbqI3FzQhQemSvqCJ4jFBHF7nPGsiHmLhaPEMZUcsVIs jFE8AozjhYi5508pfAKwMo547rhoGLI1JNtqr2QZsUt3/GIFqh89GLVxe9qZE8sceYtv 5W6r/C2O17czz6MC2/QL8XdZb/fgWysQFC37hpy2rABzh7ZZHK+8+so9btkUXK9ErSTW /5Daj7uBFv4cnZJEzun2aNzvJTXdSmcTD9AF5J5j+mohtDAIHDPAJNqrXSUcGjf1neOs vT7PVOE30yfZRSe19ds8nVEa23zccbd9yIPyoXT4/zJe9kDfcfvStHxM7RGLqUjVTkx7 dJYA== X-Gm-Message-State: APf1xPB7laEG/anbUB8MsOC03MqwyUEZgkDoLgWrr6dBpzR5GTXQOSgO sgu51X5o5LV/7D9ivRt8duRgoHbOLL6Ppy4i4961Aw== X-Received: by 10.107.135.39 with SMTP id j39mr14541905iod.160.1519685182729; Mon, 26 Feb 2018 14:46:22 -0800 (PST) MIME-Version: 1.0 Received: by 10.2.168.134 with HTTP; Mon, 26 Feb 2018 14:46:22 -0800 (PST) In-Reply-To: <20180226224224.244247-1-mka@chromium.org> References: <20180226224224.244247-1-mka@chromium.org> From: Guenter Roeck Date: Mon, 26 Feb 2018 14:46:22 -0800 Message-ID: Subject: Re: [PATCH] KVM: x86: Make enum conversion explicit in kvm_pdptr_read() To: Matthias Kaehlcke Cc: Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , x86@kernel.org, kvm@vger.kernel.org, linux-kernel , Guenter Roeck Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 26, 2018 at 2:42 PM, Matthias Kaehlcke wrote: > The type 'enum kvm_reg_ex' is an extension of 'enum kvm_reg', however > the extension is only semantical and the compiler doesn't know about the > relationship between the two types. In kvm_pdptr_read() a value of the > extended type is passed to kvm_x86_ops->cache_reg(), which expects a > value of the base type. Clang raises the following warning about the > type mismatch: > > arch/x86/kvm/kvm_cache_regs.h:44:32: warning: implicit conversion from > enumeration type 'enum kvm_reg_ex' to different enumeration type > 'enum kvm_reg' [-Wenum-conversion] > kvm_x86_ops->cache_reg(vcpu, VCPU_EXREG_PDPTR); > > Cast VCPU_EXREG_PDPTR to 'enum kvm_reg' to make the compiler happy. > > Signed-off-by: Matthias Kaehlcke Reviewed-by: Guenter Roeck > --- > arch/x86/kvm/kvm_cache_regs.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/kvm_cache_regs.h b/arch/x86/kvm/kvm_cache_regs.h > index f500293dad8d..58ba12071014 100644 > --- a/arch/x86/kvm/kvm_cache_regs.h > +++ b/arch/x86/kvm/kvm_cache_regs.h > @@ -41,7 +41,7 @@ static inline u64 kvm_pdptr_read(struct kvm_vcpu *vcpu, int index) > > if (!test_bit(VCPU_EXREG_PDPTR, > (unsigned long *)&vcpu->arch.regs_avail)) > - kvm_x86_ops->cache_reg(vcpu, VCPU_EXREG_PDPTR); > + kvm_x86_ops->cache_reg(vcpu, (enum kvm_reg)VCPU_EXREG_PDPTR); > > return vcpu->arch.walk_mmu->pdptrs[index]; > } > -- > 2.16.1.291.g4437f3f132-goog >