]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lscpu: fix possible null dereferences [coverity scan]
authorKarel Zak <kzak@redhat.com>
Thu, 19 Nov 2020 10:57:19 +0000 (11:57 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 19 Nov 2020 10:57:36 +0000 (11:57 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/lscpu.c

index 6e501b0442c614acfabaa0d4b10dc382e7c4e91a..1127d699999b3140774e40f8408901d4b1cacf79 100644 (file)
@@ -503,7 +503,9 @@ static void caches_add_line(struct lscpu_cxt *cxt,
                        break;
                case COL_CACHE_ALLSIZE:
                {
-                       uint64_t sz = lscpu_get_cache_full_size(cxt, ca->name);
+                       uint64_t sz = 0;
+                       if (ca->name)
+                               sz = lscpu_get_cache_full_size(cxt, ca->name);
                        if (!sz)
                                break;
                        if (cxt->bytes)