From d84451d38e9a36ff08af9b1424ecca51ba45e3ac Mon Sep 17 00:00:00 2001 From: Dmitry Voronetskiy Date: Wed, 19 May 2021 14:35:28 +0300 Subject: i386/kvm: The value passed to strerror should be positive Signed-off-by: Dmitry Voronetskiy Reviewed-by: Markus Armbruster Message-Id: <20210519113528.12474-1-davoronetskiy@gmail.com> Signed-off-by: Laurent Vivier --- hw/i386/kvm/i8254.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'hw/i386/kvm/i8254.c') diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c index c558893961..fa68669e8a 100644 --- a/hw/i386/kvm/i8254.c +++ b/hw/i386/kvm/i8254.c @@ -104,7 +104,7 @@ static void kvm_pit_get(PITCommonState *pit) if (kvm_has_pit_state2()) { ret = kvm_vm_ioctl(kvm_state, KVM_GET_PIT2, &kpit); if (ret < 0) { - fprintf(stderr, "KVM_GET_PIT2 failed: %s\n", strerror(ret)); + fprintf(stderr, "KVM_GET_PIT2 failed: %s\n", strerror(-ret)); abort(); } pit->channels[0].irq_disabled = kpit.flags & KVM_PIT_FLAGS_HPET_LEGACY; @@ -115,7 +115,7 @@ static void kvm_pit_get(PITCommonState *pit) */ ret = kvm_vm_ioctl(kvm_state, KVM_GET_PIT, &kpit); if (ret < 0) { - fprintf(stderr, "KVM_GET_PIT failed: %s\n", strerror(ret)); + fprintf(stderr, "KVM_GET_PIT failed: %s\n", strerror(-ret)); abort(); } } @@ -180,7 +180,7 @@ static void kvm_pit_put(PITCommonState *pit) if (ret < 0) { fprintf(stderr, "%s failed: %s\n", kvm_has_pit_state2() ? "KVM_SET_PIT2" : "KVM_SET_PIT", - strerror(ret)); + strerror(-ret)); abort(); } } @@ -272,7 +272,7 @@ static void kvm_pit_realizefn(DeviceState *dev, Error **errp) } if (ret < 0) { error_setg(errp, "Create kernel PIC irqchip failed: %s", - strerror(ret)); + strerror(-ret)); return; } switch (s->lost_tick_policy) { @@ -286,7 +286,7 @@ static void kvm_pit_realizefn(DeviceState *dev, Error **errp) if (ret < 0) { error_setg(errp, "Can't disable in-kernel PIT reinjection: %s", - strerror(ret)); + strerror(-ret)); return; } } -- cgit v1.2.3