[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 1/7] migration: fix potential overflow in multifd sen
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[Qemu-devel] [PULL 1/7] migration: fix potential overflow in multifd send |
Date: |
Tue, 24 Jul 2018 19:34:48 +0100 |
From: Peter Xu <address@hidden>
I would guess it won't happen normally, but this should ease Coverity.
>>> CID 1394385: Integer handling issues (OVERFLOW_BEFORE_WIDEN)
>>> Potentially overflowing expression "pages->used * 8192U" with type
>>> "unsigned int" (32 bits, unsigned) is evaluated using 32-bit arithmetic,
>>> and then used in a context that expects an expression of type "uint64_t"
>>> (64 bits, unsigned).
854 transferred = pages->used * TARGET_PAGE_SIZE + p->packet_len;
Fixes: CID 1394385
CC: Juan Quintela <address@hidden>
Signed-off-by: Peter Xu <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
---
migration/ram.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/migration/ram.c b/migration/ram.c
index 52dd678092..fdd108475c 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -851,7 +851,7 @@ static void multifd_send_pages(void)
p->pages->block = NULL;
multifd_send_state->pages = p->pages;
p->pages = pages;
- transferred = pages->used * TARGET_PAGE_SIZE + p->packet_len;
+ transferred = ((uint64_t) pages->used) * TARGET_PAGE_SIZE + p->packet_len;
ram_counters.multifd_bytes += transferred;
ram_counters.transferred += transferred;;
qemu_mutex_unlock(&p->mutex);
--
2.17.1
- [Qemu-devel] [PULL 0/7] migration queue for 3.0, Dr. David Alan Gilbert (git), 2018/07/24
- [Qemu-devel] [PULL 1/7] migration: fix potential overflow in multifd send,
Dr. David Alan Gilbert (git) <=
- [Qemu-devel] [PULL 2/7] migrate: Fix cancelling state warning, Dr. David Alan Gilbert (git), 2018/07/24
- [Qemu-devel] [PULL 4/7] migration: update recv bitmap only on dest vm, Dr. David Alan Gilbert (git), 2018/07/24
- [Qemu-devel] [PULL 3/7] audio/hda: Fix migration, Dr. David Alan Gilbert (git), 2018/07/24
- [Qemu-devel] [PULL 5/7] migration: disallow recovery for release-ram, Dr. David Alan Gilbert (git), 2018/07/24
- [Qemu-devel] [PULL 6/7] tests: only update last_byte when at the edge, Dr. David Alan Gilbert (git), 2018/07/24
- [Qemu-devel] [PULL 7/7] migration: fix duplicate initialization for expected_downtime and cleanup_bh, Dr. David Alan Gilbert (git), 2018/07/24
- Re: [Qemu-devel] [PULL 0/7] migration queue for 3.0, Peter Maydell, 2018/07/24