mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 09:53:10 +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.
|
* defined default for local and remote nodes.
|
||||||
*/
|
*/
|
||||||
if (!distances ||
|
if (!distances ||
|
||||||
!distances[cellid].value ||
|
cellid >= numa->nmem_nodes ||
|
||||||
!numa->mem_nodes[node].ndistances)
|
!distances[cellid].value)
|
||||||
return (node == cellid) ? LOCAL_DISTANCE : REMOTE_DISTANCE;
|
return (node == cellid) ? LOCAL_DISTANCE : REMOTE_DISTANCE;
|
||||||
|
|
||||||
return distances[cellid].value;
|
return distances[cellid].value;
|
||||||
|
Loading…
Reference in New Issue
Block a user