kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xiaoyao Li <xiaoyao.li@intel.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: Assign correct value to array.maxnent
Date: Thu, 4 Jun 2020 11:55:31 +0800	[thread overview]
Message-ID: <95f888b8-eed5-cb31-57a4-148d7708b7cb@intel.com> (raw)
In-Reply-To: <20200604024304.14643-1-xiaoyao.li@intel.com>

On 6/4/2020 10:43 AM, Xiaoyao Li wrote:
> Delay the assignment of array.maxnent to use correct value for the case
> cpuid->nent > KVM_MAX_CPUID_ENTRIES.
> 
> Fixes: e53c95e8d41e ("KVM: x86: Encapsulate CPUID entries and metadata in struct")
> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
> ---
>   arch/x86/kvm/cpuid.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index 253b8e875ccd..befff01d100c 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -870,7 +870,6 @@ int kvm_dev_ioctl_get_cpuid(struct kvm_cpuid2 *cpuid,
>   
>   	struct kvm_cpuid_array array = {
>   		.nent = 0,
> -		.maxnent = cpuid->nent,
>   	};
>   	int r, i;
>   
> @@ -887,6 +886,8 @@ int kvm_dev_ioctl_get_cpuid(struct kvm_cpuid2 *cpuid,
>   	if (!array.entries)
>   		return -ENOMEM;
>   
> +	array.maxnent = cpuid->nent;

Miss the fact that maxnent is const, V2 is coming.

> +
>   	for (i = 0; i < ARRAY_SIZE(funcs); i++) {
>   		r = get_cpuid_func(&array, funcs[i], type);
>   		if (r)
> 


      reply	other threads:[~2020-06-04  3:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-04  2:43 [PATCH] KVM: x86: Assign correct value to array.maxnent Xiaoyao Li
2020-06-04  3:55 ` Xiaoyao Li [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=95f888b8-eed5-cb31-57a4-148d7708b7cb@intel.com \
    --to=xiaoyao.li@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=sean.j.christopherson@intel.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;
as well as URLs for NNTP newsgroup(s).