qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] migration: fix potential overflow in multifd se


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] migration: fix potential overflow in multifd send
Date: Tue, 24 Jul 2018 11:06:42 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 07/24/2018 10:59 AM, Dr. David Alan Gilbert wrote:
* Peter Xu (address@hidden) wrote:
I would guess it won't happen normally, but this should ease Coverity.


+++ 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;

The outer () are not strictly necessary, as casts bind tighter than multiply.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]