diff options
author | Claudio Imbrenda <imbrenda@linux.ibm.com> | 2022-06-28 15:56:08 +0200 |
---|---|---|
committer | Janosch Frank <frankja@linux.ibm.com> | 2022-07-13 16:42:11 +0200 |
commit | e40df9efd68a621734fe03efc68b8f3e8da47cf8 (patch) | |
tree | 3ff87f6000dafa1f00bca1c65fdeaee75e3205a5 | |
parent | KVM: s390: pv: add export before import (diff) | |
download | linux-e40df9efd68a621734fe03efc68b8f3e8da47cf8.tar.xz linux-e40df9efd68a621734fe03efc68b8f3e8da47cf8.zip |
KVM: s390: pv: clear the state without memset
Do not use memset to clean the whole struct kvm_s390_pv; instead,
explicitly clear the fields that need to be cleared.
Upcoming patches will introduce new fields in the struct kvm_s390_pv
that will not need to be cleared.
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Link: https://lore.kernel.org/r/20220628135619.32410-8-imbrenda@linux.ibm.com
Message-Id: <20220628135619.32410-8-imbrenda@linux.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
-rw-r--r-- | arch/s390/kvm/pv.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/s390/kvm/pv.c b/arch/s390/kvm/pv.c index 59e0d5399113..d18c5ccfa5dc 100644 --- a/arch/s390/kvm/pv.c +++ b/arch/s390/kvm/pv.c @@ -17,6 +17,14 @@ #include <linux/sched/mm.h> #include "kvm-s390.h" +static void kvm_s390_clear_pv_state(struct kvm *kvm) +{ + kvm->arch.pv.handle = 0; + kvm->arch.pv.guest_len = 0; + kvm->arch.pv.stor_base = 0; + kvm->arch.pv.stor_var = NULL; +} + int kvm_s390_pv_destroy_cpu(struct kvm_vcpu *vcpu, u16 *rc, u16 *rrc) { int cc; @@ -111,7 +119,7 @@ static void kvm_s390_pv_dealloc_vm(struct kvm *kvm) vfree(kvm->arch.pv.stor_var); free_pages(kvm->arch.pv.stor_base, get_order(uv_info.guest_base_stor_len)); - memset(&kvm->arch.pv, 0, sizeof(kvm->arch.pv)); + kvm_s390_clear_pv_state(kvm); } static int kvm_s390_pv_alloc_vm(struct kvm *kvm) |