]> xenbits.xensource.com Git - qemu-xen.git/commit
hv-balloon: define dm_hot_add_with_region to avoid Coverity warning
authorMaciej S. Szmigiero <maciej.szmigiero@oracle.com>
Mon, 13 Nov 2023 19:00:51 +0000 (20:00 +0100)
committerMaciej S. Szmigiero <maciej.szmigiero@oracle.com>
Fri, 8 Mar 2024 13:18:56 +0000 (14:18 +0100)
commit546987284a7da9106bbead1063553cbfe7ddd697
tree8007b751492ae3fe36958e700d09d955810babf0
parent1d3b82eabb1ad6b6fdeae0d94f2fb37506a351af
hv-balloon: define dm_hot_add_with_region to avoid Coverity warning

Since the presence of a hot add memory region is optional in hot add
request message it wasn't part of this message declaration
(struct dm_hot_add).

Instead, the code allocated such enlarged message by simply adding the
necessary size for this extra field to the size of basic hot add message
struct.

However, Coverity considers accessing this extra member to be
an out-of-bounds access, even thought the memory is actually there.

Fix this by adding an extended variant of this message that explicitly has
an additional union dm_mem_page_range at its end.

CID: #1523903
Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
hw/hyperv/hv-balloon.c
include/hw/hyperv/dynmem-proto.h