[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 04/44] i386/kvm: Replace abs64() with uabs64() from host-utils
From: |
David Gibson |
Subject: |
[PULL 04/44] i386/kvm: Replace abs64() with uabs64() from host-utils |
Date: |
Thu, 30 Sep 2021 15:43:46 +1000 |
From: Luis Pires <luis.pires@eldorado.org.br>
Drop abs64() and use uabs64() from host-utils, which avoids
an undefined behavior when taking abs of the most negative value.
Signed-off-by: Luis Pires <luis.pires@eldorado.org.br>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20210910112624.72748-5-luis.pires@eldorado.org.br>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
hw/i386/kvm/i8254.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c
index fa68669e8a..191a26fa57 100644
--- a/hw/i386/kvm/i8254.c
+++ b/hw/i386/kvm/i8254.c
@@ -59,11 +59,6 @@ struct KVMPITClass {
DeviceRealize parent_realize;
};
-static int64_t abs64(int64_t v)
-{
- return v < 0 ? -v : v;
-}
-
static void kvm_pit_update_clock_offset(KVMPITState *s)
{
int64_t offset, clock_offset;
@@ -81,7 +76,7 @@ static void kvm_pit_update_clock_offset(KVMPITState *s)
clock_gettime(CLOCK_MONOTONIC, &ts);
offset -= ts.tv_nsec;
offset -= (int64_t)ts.tv_sec * 1000000000;
- if (abs64(offset) < abs64(clock_offset)) {
+ if (uabs64(offset) < uabs64(clock_offset)) {
clock_offset = offset;
}
}
--
2.31.1
- [PULL 00/44] ppc-for-6.2 queue 20210930, David Gibson, 2021/09/30
- [PULL 02/44] host-utils: fix missing zero-extension in divs128, David Gibson, 2021/09/30
- [PULL 01/44] host-utils: Fix overflow detection in divu128(), David Gibson, 2021/09/30
- [PULL 07/44] ppc/pnv: Remove useless variable, David Gibson, 2021/09/30
- [PULL 04/44] i386/kvm: Replace abs64() with uabs64() from host-utils,
David Gibson <=
- [PULL 05/44] ppc/spapr: Add a POWER10 DD2 CPU, David Gibson, 2021/09/30
- [PULL 06/44] ppc/pnv: Add a comment on the "primary-topology-index" property, David Gibson, 2021/09/30
- [PULL 10/44] ppc/pnv: Rename "id" to "quad-id" in PnvQuad, David Gibson, 2021/09/30
- [PULL 12/44] ppc/pnv: Add an assert when calculating the RAM distribution on chips, David Gibson, 2021/09/30
- [PULL 15/44] spapr.c: handle dev->id in spapr_memory_unplug_rollback(), David Gibson, 2021/09/30
- [PULL 11/44] docs/system: ppc: Update the URL for OpenPOWER firmware images, David Gibson, 2021/09/30
- [PULL 13/44] target/ppc: fix setting of CR flags in bcdcfsq, David Gibson, 2021/09/30
- [PULL 03/44] host-utils: introduce uabs64(), David Gibson, 2021/09/30
- [PULL 14/44] memory_hotplug.c: handle dev->id = NULL in acpi_memory_hotplug_write(), David Gibson, 2021/09/30
- [PULL 16/44] spapr_drc.c: do not error_report() when drc->dev->id == NULL, David Gibson, 2021/09/30