i386/kvm: The value passed to strerror should be positive
Signed-off-by: Dmitry Voronetskiy <vda1999@yandex.ru> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20210519113528.12474-1-davoronetskiy@gmail.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
0d42cd5c1d
commit
d84451d38e
@ -145,7 +145,7 @@ static void kvm_apic_put(CPUState *cs, run_on_cpu_data data)
|
|||||||
|
|
||||||
ret = kvm_vcpu_ioctl(CPU(s->cpu), KVM_SET_LAPIC, &kapic);
|
ret = kvm_vcpu_ioctl(CPU(s->cpu), KVM_SET_LAPIC, &kapic);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "KVM_SET_LAPIC failed: %s\n", strerror(ret));
|
fprintf(stderr, "KVM_SET_LAPIC failed: %s\n", strerror(-ret));
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ static void kvm_update_clock(KVMClockState *s)
|
|||||||
|
|
||||||
ret = kvm_vm_ioctl(kvm_state, KVM_GET_CLOCK, &data);
|
ret = kvm_vm_ioctl(kvm_state, KVM_GET_CLOCK, &data);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "KVM_GET_CLOCK failed: %s\n", strerror(ret));
|
fprintf(stderr, "KVM_GET_CLOCK failed: %s\n", strerror(-ret));
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
s->clock = data.clock;
|
s->clock = data.clock;
|
||||||
@ -189,7 +189,7 @@ static void kvmclock_vm_state_change(void *opaque, bool running,
|
|||||||
data.clock = s->clock;
|
data.clock = s->clock;
|
||||||
ret = kvm_vm_ioctl(kvm_state, KVM_SET_CLOCK, &data);
|
ret = kvm_vm_ioctl(kvm_state, KVM_SET_CLOCK, &data);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "KVM_SET_CLOCK failed: %s\n", strerror(ret));
|
fprintf(stderr, "KVM_SET_CLOCK failed: %s\n", strerror(-ret));
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ static void kvm_pit_get(PITCommonState *pit)
|
|||||||
if (kvm_has_pit_state2()) {
|
if (kvm_has_pit_state2()) {
|
||||||
ret = kvm_vm_ioctl(kvm_state, KVM_GET_PIT2, &kpit);
|
ret = kvm_vm_ioctl(kvm_state, KVM_GET_PIT2, &kpit);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "KVM_GET_PIT2 failed: %s\n", strerror(ret));
|
fprintf(stderr, "KVM_GET_PIT2 failed: %s\n", strerror(-ret));
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
pit->channels[0].irq_disabled = kpit.flags & KVM_PIT_FLAGS_HPET_LEGACY;
|
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);
|
ret = kvm_vm_ioctl(kvm_state, KVM_GET_PIT, &kpit);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "KVM_GET_PIT failed: %s\n", strerror(ret));
|
fprintf(stderr, "KVM_GET_PIT failed: %s\n", strerror(-ret));
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -180,7 +180,7 @@ static void kvm_pit_put(PITCommonState *pit)
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "%s failed: %s\n",
|
fprintf(stderr, "%s failed: %s\n",
|
||||||
kvm_has_pit_state2() ? "KVM_SET_PIT2" : "KVM_SET_PIT",
|
kvm_has_pit_state2() ? "KVM_SET_PIT2" : "KVM_SET_PIT",
|
||||||
strerror(ret));
|
strerror(-ret));
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -272,7 +272,7 @@ static void kvm_pit_realizefn(DeviceState *dev, Error **errp)
|
|||||||
}
|
}
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_setg(errp, "Create kernel PIC irqchip failed: %s",
|
error_setg(errp, "Create kernel PIC irqchip failed: %s",
|
||||||
strerror(ret));
|
strerror(-ret));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (s->lost_tick_policy) {
|
switch (s->lost_tick_policy) {
|
||||||
@ -286,7 +286,7 @@ static void kvm_pit_realizefn(DeviceState *dev, Error **errp)
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_setg(errp,
|
error_setg(errp,
|
||||||
"Can't disable in-kernel PIT reinjection: %s",
|
"Can't disable in-kernel PIT reinjection: %s",
|
||||||
strerror(ret));
|
strerror(-ret));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ static void kvm_pic_get(PICCommonState *s)
|
|||||||
chip.chip_id = s->master ? KVM_IRQCHIP_PIC_MASTER : KVM_IRQCHIP_PIC_SLAVE;
|
chip.chip_id = s->master ? KVM_IRQCHIP_PIC_MASTER : KVM_IRQCHIP_PIC_SLAVE;
|
||||||
ret = kvm_vm_ioctl(kvm_state, KVM_GET_IRQCHIP, &chip);
|
ret = kvm_vm_ioctl(kvm_state, KVM_GET_IRQCHIP, &chip);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "KVM_GET_IRQCHIP failed: %s\n", strerror(ret));
|
fprintf(stderr, "KVM_GET_IRQCHIP failed: %s\n", strerror(-ret));
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ static void kvm_pic_put(PICCommonState *s)
|
|||||||
|
|
||||||
ret = kvm_vm_ioctl(kvm_state, KVM_SET_IRQCHIP, &chip);
|
ret = kvm_vm_ioctl(kvm_state, KVM_SET_IRQCHIP, &chip);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "KVM_SET_IRQCHIP failed: %s\n", strerror(ret));
|
fprintf(stderr, "KVM_SET_IRQCHIP failed: %s\n", strerror(-ret));
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ static void kvm_ioapic_get(IOAPICCommonState *s)
|
|||||||
chip.chip_id = KVM_IRQCHIP_IOAPIC;
|
chip.chip_id = KVM_IRQCHIP_IOAPIC;
|
||||||
ret = kvm_vm_ioctl(kvm_state, KVM_GET_IRQCHIP, &chip);
|
ret = kvm_vm_ioctl(kvm_state, KVM_GET_IRQCHIP, &chip);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "KVM_GET_IRQCHIP failed: %s\n", strerror(ret));
|
fprintf(stderr, "KVM_GET_IRQCHIP failed: %s\n", strerror(-ret));
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ static void kvm_ioapic_put(IOAPICCommonState *s)
|
|||||||
|
|
||||||
ret = kvm_vm_ioctl(kvm_state, KVM_SET_IRQCHIP, &chip);
|
ret = kvm_vm_ioctl(kvm_state, KVM_SET_IRQCHIP, &chip);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "KVM_SET_IRQCHIP failed: %s\n", strerror(ret));
|
fprintf(stderr, "KVM_SET_IRQCHIP failed: %s\n", strerror(-ret));
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user