]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
irqtop: don't ignore sscanf() return code [coverity scan]
authorKarel Zak <kzak@redhat.com>
Mon, 29 Nov 2021 14:32:27 +0000 (15:32 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 29 Nov 2021 14:32:27 +0000 (15:32 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/irq-common.c

index 3506753947011e897a3779bd92a02fe5d56ec8f7..aa10f7e05bd7d253d1e1948ba255903140fc6539 100644 (file)
@@ -290,7 +290,8 @@ static struct irq_stat *get_irqinfo(int softirq)
                for (index = 0; (index < stat->nr_active_cpu) && (tmp - line < length); index++) {
                        struct irq_cpu *cpu = &stat->cpus[index];
 
-                       sscanf(tmp, " %10lu", &count);
+                       if (sscanf(tmp, " %10lu", &count) != 1)
+                               continue;
                        curr->total += count;
                        cpu->total += count;
                        stat->total_irq += count;