From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: Fix warning due to implicit truncation on 32-bit KVM
Date: Thu, 05 Mar 2020 11:00:20 +0100 [thread overview]
Message-ID: <87wo7zcea3.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20200305002422.20968-1-sean.j.christopherson@intel.com>
Sean Christopherson <sean.j.christopherson@intel.com> writes:
> Explicitly cast the integer literal to an unsigned long when stuffing a
> non-canonical value into the host virtual address during private memslot
> deletion. The explicit cast fixes a warning that gets promoted to an
> error when running with KVM's newfangled -Werror setting.
>
> arch/x86/kvm/x86.c:9739:9: error: large integer implicitly truncated
> to unsigned type [-Werror=overflow]
>
> Fixes: a3e967c0b87d3 ("KVM: Terminate memslot walks via used_slots"
Missing ')'
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
> arch/x86/kvm/x86.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index ba4d476b79ad..fa03f31ab33c 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -9735,8 +9735,12 @@ int __x86_set_memory_region(struct kvm *kvm, int id, gpa_t gpa, u32 size)
> if (!slot || !slot->npages)
> return 0;
>
> - /* Stuff a non-canonical value to catch use-after-delete. */
> - hva = 0xdeadull << 48;
> + /*
> + * Stuff a non-canonical value to catch use-after-delete. This
> + * ends up being 0 on 32-bit KVM, but there's no better
> + * alternative.
> + */
> + hva = (unsigned long)(0xdeadull << 48);
> old_npages = slot->npages;
> }
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
--
Vitaly
next prev parent reply other threads:[~2020-03-05 10:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-05 0:24 [PATCH] KVM: x86: Fix warning due to implicit truncation on 32-bit KVM Sean Christopherson
2020-03-05 10:00 ` Vitaly Kuznetsov [this message]
2020-03-05 16:04 ` Sean Christopherson
2020-03-05 14:29 ` Paolo Bonzini
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=87wo7zcea3.fsf@vitty.brq.redhat.com \
--to=vkuznets@redhat.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=sean.j.christopherson@intel.com \
--cc=wanpengli@tencent.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.