[PATCH v2 1/5] virDomainNumaGetNodeDistance: Fix input arguments validation

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

 



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@xxxxxxxxxx>
---
 src/conf/numa_conf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index 7bba4120b..c2f0d1ca8 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -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;
-- 
2.13.6

--
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]
  Powered by Linux