From f3030d34401ffa1c6dd922eea42225b49b7077c0 Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Thu, 4 May 2023 13:38:34 +0200 Subject: [PATCH] migration: qemu_file_total_transferred() function is monotonic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So delta_bytes can only be greater or equal to zero. Never negative. Signed-off-by: Juan Quintela Reviewed-by: Daniel P. Berrangé Message-Id: <20230504113841.23130-3-quintela@redhat.com> --- migration/block.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/migration/block.c b/migration/block.c index 6d532ac7a2..3499f75e37 100644 --- a/migration/block.c +++ b/migration/block.c @@ -801,13 +801,7 @@ static int block_save_iterate(QEMUFile *f, void *opaque) qemu_put_be64(f, BLK_MIG_FLAG_EOS); delta_bytes = qemu_file_total_transferred(f) - last_bytes; - if (delta_bytes > 0) { - return 1; - } else if (delta_bytes < 0) { - return -1; - } else { - return 0; - } + return (delta_bytes > 0); } /* Called with iothread lock taken. */