From: Michal Privoznik Date: Tue, 18 Aug 2020 10:46:38 +0000 (+0200) Subject: numa_conf: Properly check for caches in virDomainNumaDefValidate() X-Git-Tag: v6.7.0-rc1~100 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e41ac71fca309b50e2c8e6ec142d8fe1280ca2ad;p=thirdparty%2Flibvirt.git numa_conf: Properly check for caches in virDomainNumaDefValidate() When adding support for HMAT, in f0611fe8830 I've introduced a check which aims to validate /domain/cpu/numa/interconnects. As a part of that, there is a loop which checks whether all with @cache attribute refer to an existing cache level. For instance: This XML defines that accessing L1 cache of node #0 from node #0 has latency of 5ns. However, the loop was not written properly. Well, the check in it, as it was always checking for the first cache in the target node and not the rest. Therefore, the following example errors out: This errors out even though it is a valid configuration. The L1 cache under node #0 is still present. Fixes: f0611fe8830 Signed-off-by: Michal Privoznik Reviewed-by: Laine Stump --- diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c index 50d57ba8f6..9305e125b7 100644 --- a/src/conf/numa_conf.c +++ b/src/conf/numa_conf.c @@ -1421,7 +1421,7 @@ virDomainNumaDefValidate(const virDomainNuma *def) if (l->cache > 0) { for (j = 0; j < def->mem_nodes[l->target].ncaches; j++) { - const virDomainNumaCache *cache = def->mem_nodes[l->target].caches; + const virDomainNumaCache *cache = &def->mem_nodes[l->target].caches[j]; if (l->cache == cache->level) break;