Re: [patch V6 04/16] x86/irq: Make irqstats array based
From: Dan Carpenter
Date: Sat May 30 2026 - 05:36:47 EST
On Sun, May 17, 2026 at 10:01:48PM +0200, Thomas Gleixner wrote:
> +int arch_show_interrupts(struct seq_file *p, int prec)
> +{
> + const struct irq_stat_info *info = irq_stat_info;
> +
> + for (unsigned int i = 0; i < ARRAY_SIZE(irq_stat_info); i++, info++) {
> + if (info->skip_vector)
> + continue;
> +
> + seq_printf(p, "%*s:", prec, info->symbol);
^^^^ ^^^^
Ideally, this would be called "width" instead of "prec" since this isn't
a precision specifier "%.*s", it's a width "%*s" specifier.
This was introduced in 2009 in commit 7a81d9a7da03 ("x86: smarten
/proc/interrupts output"). It's done consistenly everywhere and it's
pretty clear that width is intended.
Static checkers complain because people use precision specifiers for
to not write beyond the end of the output buffer and this looks so
suspicious.
regards,
dan carpenter
> + irq_proc_emit_counts(p, &irq_stat.counts[i]);
> + seq_puts(p, info->text);
> + }
> +
> + seq_printf(p, "%*s: %10u\n", prec, "ERR", atomic_read(&irq_err_count));
> + if (IS_ENABLED(CONFIG_X86_IO_APIC))
> + seq_printf(p, "%*s: %10u\n", prec, "MIS", atomic_read(&irq_mis_count));
> + return 0;
> +}