From: Karel Zak Date: Thu, 19 Nov 2020 10:57:19 +0000 (+0100) Subject: lscpu: fix possible null dereferences [coverity scan] X-Git-Tag: v2.37-rc1~286 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b9b28b641e4a0891fb0949d53ffe5b2f9a34e6a7;p=thirdparty%2Futil-linux.git lscpu: fix possible null dereferences [coverity scan] Signed-off-by: Karel Zak --- diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c index 6e501b0442..1127d69999 100644 --- a/sys-utils/lscpu.c +++ b/sys-utils/lscpu.c @@ -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)