From 8baf0f025f975267e3f9a3af71f69137130907b7 Mon Sep 17 00:00:00 2001 From: Jincheng Miao Date: Wed, 24 Sep 2014 13:45:30 +0800 Subject: [PATCH] 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 Signed-off-by: Michal Privoznik --- src/nodeinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 245992275d..04ae38223e 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -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; -- GitLab