From: Paolo Bonzini <pbonzini@redhat.com>
To: Jinrong Liang <ljr.kernel@gmail.com>
Cc: Wanpeng Li <wanpengli@tencent.com>,
Sean Christopherson <seanjc@google.com>,
Jim Mattson <jmattson@google.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Joerg Roedel <joro@8bytes.org>,
Jinrong Liang <cloudliang@tencent.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests: kvm/x86: Fix the warning in lib/x86_64/processor.c
Date: Wed, 19 Jan 2022 19:37:50 +0100 [thread overview]
Message-ID: <d4b47a8e-77f2-eef2-2245-bdc7eaf8f57f@redhat.com> (raw)
In-Reply-To: <20220119140325.59369-1-cloudliang@tencent.com>
On 1/19/22 15:03, Jinrong Liang wrote:
> From: Jinrong Liang <cloudliang@tencent.com>
>
> The following warning appears when executing
> make -C tools/testing/selftests/kvm
>
> In file included from lib/x86_64/processor.c:11:
> lib/x86_64/processor.c: In function ':
> include/x86_64/processor.h:290:2: warning: 'ecx' may be used uninitialized in this
> function [-Wmaybe-uninitialized]
> asm volatile("cpuid"
> ^~~
> lib/x86_64/processor.c:1523:21: note: 'ecx' was declared here
> uint32_t eax, ebx, ecx, edx, max_ext_leaf;
>
> Just initialize ecx to remove this warning.
>
> Fixes: c8cc43c1eae2 ("selftests: KVM: avoid failures due to reserved
> HyperTransport region")
>
> Signed-off-by: Jinrong Liang <cloudliang@tencent.com>
> ---
> tools/testing/selftests/kvm/lib/x86_64/processor.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c
> index 59dcfe1967cc..4a4c7945cf3e 100644
> --- a/tools/testing/selftests/kvm/lib/x86_64/processor.c
> +++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c
> @@ -1520,7 +1520,7 @@ unsigned long vm_compute_max_gfn(struct kvm_vm *vm)
> {
> const unsigned long num_ht_pages = 12 << (30 - vm->page_shift); /* 12 GiB */
> unsigned long ht_gfn, max_gfn, max_pfn;
> - uint32_t eax, ebx, ecx, edx, max_ext_leaf;
> + uint32_t eax, ebx, ecx = 0, edx, max_ext_leaf;
>
> max_gfn = (1ULL << (vm->pa_bits - vm->page_shift)) - 1;
>
A separate assignment of "ecx = 0" is slightly more conforming to the
coding standards. Queued nevertheless, thanks.
Paolo
prev parent reply other threads:[~2022-01-19 18:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-19 14:03 Jinrong Liang
2022-01-19 18:37 ` Paolo Bonzini [this message]
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=d4b47a8e-77f2-eef2-2245-bdc7eaf8f57f@redhat.com \
--to=pbonzini@redhat.com \
--cc=cloudliang@tencent.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ljr.kernel@gmail.com \
--cc=seanjc@google.com \
--cc=vkuznets@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome