@@ -913,10 +913,8 @@ static void migration_update_rates(RAMState *rs, int64_t end_time)
unencoded_size = (xbzrle_counters.pages - rs->xbzrle_pages_prev) *
TARGET_PAGE_SIZE;
encoded_size = xbzrle_counters.bytes - rs->xbzrle_bytes_prev;
- if (xbzrle_counters.pages == rs->xbzrle_pages_prev) {
+ if (xbzrle_counters.pages == rs->xbzrle_pages_prev || !encoded_size) {
xbzrle_counters.encoding_rate = 0;
- } else if (!encoded_size) {
- xbzrle_counters.encoding_rate = UINT64_MAX;
} else {
xbzrle_counters.encoding_rate = unencoded_size / encoded_size;
}