]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virsh: Fix overflow error of freepages command
authorAdam Julis <ajulis@redhat.com>
Tue, 5 Mar 2024 10:43:03 +0000 (11:43 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 5 Mar 2024 11:22:06 +0000 (12:22 +0100)
commitbdee774285da1f0103ceeecb255a0113681d234c
tree9a01ef99de5acd1d665677298d582a600404c6d9
parentba3a5604c9c942c6257630b112b190e0752b7dba
virsh: Fix overflow error of freepages command

Trying to print pages of a size larger than the UINT_MAX of the
given platform (for example, 4G on 64-bit ARM), results in a
system error even though this is a legitimate request.

The vshCommandOptScaledInt() used for parsing the pagesize is
given UINT_MAX as the upper limit. The parsed value is then
divided by 1024 and fed to virNodeGetFreePages() which expects an
unsigned int. We can't change the public API but the upper limit
can be raised by the factor of 1024.

Resolves: https://issues.redhat.com/browse/RHEL-23608

Signed-off-by: Adam Julis <ajulis@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tools/virsh-host.c