Re: [OPERA] Another potential error detected by static analysis tool (2.6.4)

From: Andreas Dilger
Date: Fri May 07 2004 - 18:08:40 EST


On May 07, 2004 17:22 -0500, Zhenmin Li wrote:
> Version: 2.6.4
> Files:
> /arch/alpha/kernel/irq.c
>
> --- 539,547 ----
> #ifdef CONFIG_SMP
> if (i == 0) {
> seq_puts(p, " ");
> ! for (i = 0; i < NR_CPUS; i++)
> ! if (cpu_online(i))
> ! seq_printf(p, "CPU%d ", i);
> seq_putc(p, '\n');
> }
> #endif
>
>
> Maybe change to:
> *** 539,547 ****
> #ifdef CONFIG_SMP
> if (i == 0) {
> seq_puts(p, " ");
> ! for (j = 0; j < NR_CPUS; j++)
> ! if (cpu_online(j))
> ! seq_printf(p, "CPU%d ", j);
> seq_putc(p, '\n');
> }
> #endif

The real bug is that someone used "i" for something meaningful other than
a loop counter. In addition to your change, this should be fixed to call
that variable "irq" or something more useful ;-).

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/