mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
testNodeGetCellsFreeMemory: Fix off by one error
Consider the following scenario: virsh # freecell --all 0: 2048 KiB 1: 4096 KiB -------------------- Total: 6144 KiB virsh # freecell 0 0: 2048 KiB virsh # freecell 1 1: 4096 KiB And now before this change: virsh # freecell 2 After this change: virsh # freecell 2 error: invalid argument: Range exceeds available cells Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
c72690e279
commit
e1a33ed18c
@ -2710,7 +2710,7 @@ static int testNodeGetCellsFreeMemory(virConnectPtr conn,
|
||||
int ret = -1;
|
||||
|
||||
testDriverLock(privconn);
|
||||
if (startCell > privconn->numCells) {
|
||||
if (startCell >= privconn->numCells) {
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
"%s", _("Range exceeds available cells"));
|
||||
goto cleanup;
|
||||
|
Loading…
Reference in New Issue
Block a user