[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/28] migration: Fix incorrect integer->float conversion caught b
From: |
Juan Quintela |
Subject: |
[PULL 09/28] migration: Fix incorrect integer->float conversion caught by clang |
Date: |
Fri, 10 Jan 2020 18:31:56 +0100 |
From: Fangrui Song <address@hidden>
Clang does not like qmp_migrate_set_downtime()'s code to clamp double
@value to 0..INT64_MAX:
qemu/migration/migration.c:2038:24: error: implicit conversion from 'long'
to 'double' changes value from 9223372036854775807 to 9223372036854775808
[-Werror,-Wimplicit-int-float-conversion]
The warning will be enabled by default in clang 10. It is not
available for clang <= 9.
The clamp is actually useless; @value is checked to be within
0..MAX_MIGRATE_DOWNTIME_SECONDS immediately before. Delete it.
While there, make the conversion from double to int64_t explicit.
Signed-off-by: Fangrui Song <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
[Patch split, commit message improved]
Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>
---
migration/migration.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index 27500d09a9..f79d0bf89a 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2035,11 +2035,10 @@ void qmp_migrate_set_downtime(double value, Error
**errp)
}
value *= 1000; /* Convert to milliseconds */
- value = MAX(0, MIN(INT64_MAX, value));
MigrateSetParameters p = {
.has_downtime_limit = true,
- .downtime_limit = value,
+ .downtime_limit = (int64_t)value,
};
qmp_migrate_set_parameters(&p, errp);
--
2.24.1
- [PULL 00/28] Migration pull patches, Juan Quintela, 2020/01/10
- [PULL 01/28] migration-test: Add migration multifd test, Juan Quintela, 2020/01/10
- [PULL 02/28] migration: Make sure that we don't call write() in case of error, Juan Quintela, 2020/01/10
- [PULL 03/28] migration-test: introduce functions to handle string parameters, Juan Quintela, 2020/01/10
- [PULL 04/28] migration-test: ppc64: fix FORTH test program, Juan Quintela, 2020/01/10
- [PULL 05/28] runstate: ignore finishmigrate -> prelaunch transition, Juan Quintela, 2020/01/10
- [PULL 06/28] ram.c: remove unneeded labels, Juan Quintela, 2020/01/10
- [PULL 07/28] migration: Rate limit inside host pages, Juan Quintela, 2020/01/10
- [PULL 08/28] migration: Support QLIST migration, Juan Quintela, 2020/01/10
- [PULL 09/28] migration: Fix incorrect integer->float conversion caught by clang,
Juan Quintela <=
- [PULL 11/28] misc: use QEMU_IS_ALIGNED, Juan Quintela, 2020/01/10
- [PULL 12/28] migration: add savevm_state_handler_remove(), Juan Quintela, 2020/01/10
- [PULL 10/28] migration: Fix the re-run check of the migrate-incoming command, Juan Quintela, 2020/01/10
- [PULL 13/28] migration: savevm_state_handler_insert: constant-time element insertion, Juan Quintela, 2020/01/10
- [PULL 14/28] migration/ram: Yield periodically to the main loop, Juan Quintela, 2020/01/10
- [PULL 15/28] migration/postcopy: reduce memset when it is zero page and matches_target_page_size, Juan Quintela, 2020/01/10
- [PULL 16/28] migration/postcopy: wait for decompress thread in precopy, Juan Quintela, 2020/01/10
- [PULL 17/28] migration/postcopy: count target page number to decide the place_needed, Juan Quintela, 2020/01/10
- [PULL 18/28] migration/postcopy: set all_zero to true on the first target page, Juan Quintela, 2020/01/10
- [PULL 19/28] migration/postcopy: enable random order target page arrival, Juan Quintela, 2020/01/10