Richard W.M. Jones wrote:
+ if (startCell > nbCells - 1)
+ return -1;
Surely, the condition should be `startCell + maxCells > nbCells'?
Actually I will discuss this now since I plan to leave it as is.
First I'll make sure terms are clear. startCell is the first cell to
gather freeMems info on. maxCells is the maximum number of entries
available in freeMems (otherwise the buffer will be overrun). nbCells is
the total number of cells on the node.
I assume the caller could legally specify a maxCells value that is
greater than nbCells. It just means they provided a bigger buffer than
necessary. My test here is just verifying that the startCell provided is
not out of range of the number of cells that exist on the node. freeMems
entries will be returned for up to maxCells cells, starting from
startCell, ending at either nbCells, or maxCells number of entries,
whichever comes first. Does that make sense?
Rich.
--
Elizabeth Kon (Beth)
IBM Linux Technology Center
Open Hypervisor Team
email: eak@xxxxxxxxxx
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list