From: David Hildenbrand <david@redhat.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] kvm: vmx: Silence a shift wrap warning
Date: Mon, 25 Mar 2019 09:29:40 +0000 [thread overview]
Message-ID: <a9f42696-4077-5510-2d48-a94a75f2ade9@redhat.com> (raw)
In-Reply-To: <20190325090448.GB16023@kadam>
On 25.03.19 10:04, Dan Carpenter wrote:
> This code generates a Smatch warning:
>
> arch/x86/kvm/vmx/nested.c:4828 handle_vmfunc() warn: should '(1 << function)' be a 64 bit type?
>
> The warning is generated because "vmcs12->vm_function_control" is a u64
> but the shift can only test the lower 32 bits. This doesn't cause a
> problem in the current code because we only use BIT(0). This patch just
> silences the static checker warning.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> arch/x86/kvm/vmx/nested.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index f24a2c225070..1f4398246bd9 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -4825,7 +4825,7 @@ static int handle_vmfunc(struct kvm_vcpu *vcpu)
> }
>
> vmcs12 = get_vmcs12(vcpu);
> - if ((vmcs12->vm_function_control & (1 << function)) = 0)
> + if ((vmcs12->vm_function_control & (1ULL << function)) = 0)
I guess one set of parentheses could be dropped here, while touching the
line.
Reviewed-by: David Hildenbrand <david@redhat.com>
> goto fail;
>
> switch (function) {
>
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2019-03-25 9:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-25 9:04 [PATCH] kvm: vmx: Silence a shift wrap warning Dan Carpenter
2019-03-25 9:29 ` David Hildenbrand [this message]
2019-03-26 7:07 ` Dan Carpenter
2019-03-26 8:10 ` David Hildenbrand
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=a9f42696-4077-5510-2d48-a94a75f2ade9@redhat.com \
--to=david@redhat.com \
--cc=kernel-janitors@vger.kernel.org \
/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