提交 0ededbb8 编写于 作者: M Michal Privoznik

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: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 96f7a045
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册