mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
virDomainNumaGetNodeDistance: Fix input arguments validation
There's no point in checking if numa->mem_nodes[node].ndistances is set if we check for numa->mem_nodes[node].distances. However, it makes sense to check if the sibling node (@cellid) caller passed falls within boundaries. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
96f7a045e9
commit
0ededbb84e
@ -1153,8 +1153,8 @@ virDomainNumaGetNodeDistance(virDomainNumaPtr numa,
|
||||
* defined default for local and remote nodes.
|
||||
*/
|
||||
if (!distances ||
|
||||
!distances[cellid].value ||
|
||||
!numa->mem_nodes[node].ndistances)
|
||||
cellid >= numa->nmem_nodes ||
|
||||
!distances[cellid].value)
|
||||
return (node == cellid) ? LOCAL_DISTANCE : REMOTE_DISTANCE;
|
||||
|
||||
return distances[cellid].value;
|
||||
|
Loading…
x
Reference in New Issue
Block a user