From: Sean Christopherson <seanjc@google.com>
To: "彭浩(Richard)" <richard.peng@oppo.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
"Suravee.Suthikulpanit@amd.com" <Suravee.Suthikulpanit@amd.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH] kvm:svm: Return the correct error code
Date: Mon, 30 Nov 2020 19:58:51 +0000 [thread overview]
Message-ID: <X8VO+4/r+LltG7AF@google.com> (raw)
In-Reply-To: <HKAPR02MB42915D77D43D4ED125BD2121E0F90@HKAPR02MB4291.apcprd02.prod.outlook.com>
On Thu, Nov 26, 2020, 彭浩(Richard) wrote:
> The return value of sev_asid_new is assigned to the variable asid, which
> should be returned directly if the asid is an error code.
>
> Fixes: 1654efcbc431 ("KVM: SVM: Add KVM_SEV_INIT command")
> Signed-off-by: Peng Hao <richard.peng@oppo.com>
It's probably worth noting in the changelog that this is a nop. sev_asid_new()
can only fail with -EBUSY, and ret is guaranteed to be -EBUSY as well. I agree
it's probably better to return the result of sev_asid_new() instead of assuuming
it will always return -EBUSY.
> ---
> arch/x86/kvm/svm/sev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> index 566f4d18185b..41cea6b69860 100644
> --- a/arch/x86/kvm/svm/sev.c
> +++ b/arch/x86/kvm/svm/sev.c
> @@ -174,7 +174,7 @@ static int sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp)
>
> asid = sev_asid_new();
> if (asid < 0)
> - return ret;
> + return asid;
>
> ret = sev_platform_init(&argp->error);
> if (ret)
> --
> 2.18.4
prev parent reply other threads:[~2020-11-30 19:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-26 7:13 [PATCH] kvm:svm: Return the correct error code 彭浩(Richard)
2020-11-30 19:58 ` Sean Christopherson [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=X8VO+4/r+LltG7AF@google.com \
--to=seanjc@google.com \
--cc=Suravee.Suthikulpanit@amd.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=richard.peng@oppo.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