summaryrefslogtreecommitdiffstats
path: root/sys-utils/lscpu.c
diff options
context:
space:
mode:
authorKarel Zak2012-01-31 15:00:52 +0100
committerKarel Zak2012-01-31 15:00:52 +0100
commit960bf13048450b1a630624b369129eb4e13b4f45 (patch)
treeb7e5018f51ebc5e6ce662efd097721719c4d9f74 /sys-utils/lscpu.c
parentlibblkid: make fd usage in md code more robust (diff)
downloadkernel-qcow2-util-linux-960bf13048450b1a630624b369129eb4e13b4f45.tar.gz
kernel-qcow2-util-linux-960bf13048450b1a630624b369129eb4e13b4f45.tar.xz
kernel-qcow2-util-linux-960bf13048450b1a630624b369129eb4e13b4f45.zip
lscpu: dereferencing NULL pointer [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/lscpu.c')
-rw-r--r--sys-utils/lscpu.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index 5214a1278..a9ca2fe59 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -1322,7 +1322,9 @@ int main(int argc, char *argv[])
read_configured(desc, i);
}
- qsort(desc->caches, desc->ncaches, sizeof(struct cpu_cache), cachecmp);
+ if (desc->caches)
+ qsort(desc->caches, desc->ncaches,
+ sizeof(struct cpu_cache), cachecmp);
read_nodes(desc);
read_hypervisor(desc);