Re: RFC PATCH - Initial NodeGetCellsFreeMemory patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]