diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/s390/kvm/kvm-s390.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index dc2b580e27bc..0cba935d1282 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
@@ -312,11 +312,17 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) | |||
312 | struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, | 312 | struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, |
313 | unsigned int id) | 313 | unsigned int id) |
314 | { | 314 | { |
315 | struct kvm_vcpu *vcpu = kzalloc(sizeof(struct kvm_vcpu), GFP_KERNEL); | 315 | struct kvm_vcpu *vcpu; |
316 | int rc = -ENOMEM; | 316 | int rc = -EINVAL; |
317 | |||
318 | if (id >= KVM_MAX_VCPUS) | ||
319 | goto out; | ||
320 | |||
321 | rc = -ENOMEM; | ||
317 | 322 | ||
323 | vcpu = kzalloc(sizeof(struct kvm_vcpu), GFP_KERNEL); | ||
318 | if (!vcpu) | 324 | if (!vcpu) |
319 | goto out_nomem; | 325 | goto out; |
320 | 326 | ||
321 | vcpu->arch.sie_block = (struct kvm_s390_sie_block *) | 327 | vcpu->arch.sie_block = (struct kvm_s390_sie_block *) |
322 | get_zeroed_page(GFP_KERNEL); | 328 | get_zeroed_page(GFP_KERNEL); |
@@ -352,7 +358,7 @@ out_free_sie_block: | |||
352 | free_page((unsigned long)(vcpu->arch.sie_block)); | 358 | free_page((unsigned long)(vcpu->arch.sie_block)); |
353 | out_free_cpu: | 359 | out_free_cpu: |
354 | kfree(vcpu); | 360 | kfree(vcpu); |
355 | out_nomem: | 361 | out: |
356 | return ERR_PTR(rc); | 362 | return ERR_PTR(rc); |
357 | } | 363 | } |
358 | 364 | ||