aboutsummaryrefslogtreecommitdiff
path: root/include/hw/hyperv
diff options
context:
space:
mode:
authorMaciej S. Szmigiero <maciej.szmigiero@oracle.com>2023-11-13 20:00:51 +0100
committerMaciej S. Szmigiero <maciej.szmigiero@oracle.com>2024-03-08 14:18:56 +0100
commit546987284a7da9106bbead1063553cbfe7ddd697 (patch)
tree8007b751492ae3fe36958e700d09d955810babf0 /include/hw/hyperv
parent1d3b82eabb1ad6b6fdeae0d94f2fb37506a351af (diff)
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>
Diffstat (limited to 'include/hw/hyperv')
-rw-r--r--include/hw/hyperv/dynmem-proto.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/hw/hyperv/dynmem-proto.h b/include/hw/hyperv/dynmem-proto.h
index a657786a94..68b8b606f2 100644
--- a/include/hw/hyperv/dynmem-proto.h
+++ b/include/hw/hyperv/dynmem-proto.h
@@ -328,7 +328,8 @@ struct dm_unballoon_response {
/*
* Hot add request message. Message sent from the host to the guest.
*
- * mem_range: Memory range to hot add.
+ * range: Memory range to hot add.
+ * region: Explicit hot add memory region for guest to use. Optional.
*
*/
@@ -337,6 +338,12 @@ struct dm_hot_add {
union dm_mem_page_range range;
} QEMU_PACKED;
+struct dm_hot_add_with_region {
+ struct dm_header hdr;
+ union dm_mem_page_range range;
+ union dm_mem_page_range region;
+} QEMU_PACKED;
+
/*
* Hot add response message.
* This message is sent by the guest to report the status of a hot add request.