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>
* 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;