]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lscpu: don't use NULL sharedmap
authorKarel Zak <kzak@redhat.com>
Wed, 20 Mar 2024 13:42:28 +0000 (14:42 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 20 Mar 2024 13:42:28 +0000 (14:42 +0100)
Fixes: https://github.com/util-linux/util-linux/issues/2846
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/lscpu-topology.c

index 7ee18e785e90b6248be9f8db6a7b19f29845ff17..e3742e319f55bd4cff6a6ec0ee6671a872966d29 100644 (file)
@@ -253,7 +253,8 @@ struct lscpu_cache *lscpu_cpu_get_cache(struct lscpu_cxt *cxt,
        for (i = 0; i < cxt->ncaches; i++) {
                struct lscpu_cache *ca = &cxt->caches[i];
 
-               if (strcmp(ca->name, name) == 0 &&
+               if (ca->sharedmap &&
+                   strcmp(ca->name, name) == 0 &&
                    CPU_ISSET_S(cpu->logical_id, cxt->setsize, ca->sharedmap))
                        return ca;
        }