OSDN Git Service

KVM: x86: report sev_pin_memory errors with PTR_ERR
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 23 Jun 2020 09:12:24 +0000 (05:12 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 8 Jul 2020 20:21:42 +0000 (16:21 -0400)
commita8d908b5873cad212b0f74569f5a23b804e694ce
tree6cfe52868ea5b2408e5a6e8b6c386828c4d1e33c
parentdc42c8ae0a7762378102dd043779d19331804cce
KVM: x86: report sev_pin_memory errors with PTR_ERR

Callers of sev_pin_memory() treat
NULL differently:

sev_launch_secret()/svm_register_enc_region() return -ENOMEM
sev_dbg_crypt() returns -EFAULT.

Switching to ERR_PTR() preserves the error and enables cleaner reporting of
different kinds of failures.

Suggested-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/sev.c