Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1200987
| From | Paolo Bonzini <pbonzini@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] kvm:arm:Fix error handling in the function vgic_v3_probe |
| Date | 2015-08-05 19:00 +0200 |
| Message-ID | <pUacO-7dQ-7@gated-at.bofh.it> (permalink) |
| References | <pUacO-7dQ-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 05/08/2015 18:48, Nicholas Krause wrote:
> This fixes the error handling in the function vgic_v3_probe
> for when calling the function kvm_register_device_ops to check
> if the call to this function has returned a error code and if
> so jump to the label out with goto to cleanup no longer required
> resources used by the function vgic_v3_probe before returning the
> error code from the call to kvm_register_device_ops to the caller
> of the function vgic_v3_probe.
>
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
> virt/kvm/arm/vgic-v3.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/virt/kvm/arm/vgic-v3.c b/virt/kvm/arm/vgic-v3.c
> index dff0602..5102aa2 100644
> --- a/virt/kvm/arm/vgic-v3.c
> +++ b/virt/kvm/arm/vgic-v3.c
> @@ -264,12 +264,16 @@ int vgic_v3_probe(struct device_node *vgic_node,
> } else {
> vgic->vcpu_base = vcpu_res.start;
> vgic->can_emulate_gicv2 = true;
> - kvm_register_device_ops(&kvm_arm_vgic_v2_ops,
> - KVM_DEV_TYPE_ARM_VGIC_V2);
> + ret = kvm_register_device_ops(&kvm_arm_vgic_v2_ops,
> + KVM_DEV_TYPE_ARM_VGIC_V2);
> + if (ret)
> + goto out;
> }
> if (vgic->vcpu_base == 0)
> kvm_info("disabling GICv2 emulation\n");
> - kvm_register_device_ops(&kvm_arm_vgic_v3_ops, KVM_DEV_TYPE_ARM_VGIC_V3);
> + ret = kvm_register_device_ops(&kvm_arm_vgic_v3_ops, KVM_DEV_TYPE_ARM_VGIC_V3);
> + if (ret)
> + goto out;
>
> vgic->vctrl_base = NULL;
> vgic->type = VGIC_V3;
>
This really should never happen. Perhaps kvm_register_device_ops should
instead return void, and WARN() when it currently returns an error.
Paolo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
Re: [PATCH] kvm:arm:Fix error handling in the function vgic_v3_probe Paolo Bonzini <pbonzini@redhat.com> - 2015-08-05 19:00 +0200
Re: [PATCH] kvm:arm:Fix error handling in the function vgic_v3_probe Marc Zyngier <marc.zyngier@arm.com> - 2015-08-06 10:10 +0200
Re: [PATCH] kvm:arm:Fix error handling in the function vgic_v3_probe Christoffer Dall <christoffer.dall@linaro.org> - 2015-08-06 14:10 +0200
Re: [PATCH] kvm:arm:Fix error handling in the function vgic_v3_probe Paolo Bonzini <pbonzini@redhat.com> - 2015-08-06 14:10 +0200
Re: [PATCH] kvm:arm:Fix error handling in the function vgic_v3_probe Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2015-08-07 02:50 +0200
Re: [PATCH] kvm:arm:Fix error handling in the function vgic_v3_probe Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2015-08-07 03:40 +0200
csiph-web