On Fri, Oct 23, 2026 at 15:28:51 +0200, Michal Privoznik wrote: > From: Michal Privoznik <[email protected]> > > The virDomainGetInfo() fills virDomainInfo structure for given > domain. The struct contains memory and maxMem members (among > others) to store current and maximum memory for the domain. Both > members are of 'unsigned long' type. Now, inside the ESX driver's > implementation (esxDomainGetInfo()) these values are stored in a > variables of int64_t and int32_t, respectively. But since both > values, as reported by hypervisor are in MiB, they are multiplied > by 1024 because we report memory sizes in KiB. Well, for very > large guests, and 32bit hosts, unsigned long might not be large > enough to hold the value. Check for overflow and also in case of > 'maxMem' (which is multiplied directly) specify the type of > '1024' constant to ensure proper typecast before multiplication. > > Resolves: https://gitlab.com/libvirt/libvirt/-/work_items/937 > Signed-off-by: Michal Privoznik <[email protected]> > --- > src/esx/esx_driver.c | 21 +++++++++++++++++++-- > 1 file changed, 19 insertions(+), 2 deletions(-)
Reviewed-by: Jiri Denemark <[email protected]>
