nodeinfo: fix nodeGetFreePages when max node is zero

In nodeGetFreePages, if startCell is given by '0',
and the max node number is '0' too. The for-loop
wouldn't be executed.
So convert it to while-loop.

Before:
> virsh freepages --cellno 0 --pagesize 4
error: internal error: no suitable info found

After:
> virsh freepages --cellno 0 --pagesize 4
4KiB: 472637

Signed-off-by: Jincheng Miao <jmiao@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Jincheng Miao 2014-09-24 13:45:30 +08:00 committed by Michal Privoznik
parent 0114a1e703
commit 8baf0f025f

View File

@ -2043,7 +2043,7 @@ nodeGetFreePages(unsigned int npages,
lastCell = MIN(lastCell, startCell + cellCount);
for (cell = startCell; cell < lastCell; cell++) {
for (cell = startCell; cell <= lastCell; cell++) {
for (i = 0; i < npages; i++) {
unsigned int page_size = pages[i];
unsigned int page_free;