mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user