netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* tg3_read_partno(): possible array overrun
@ 2006-11-06  9:45 Adrian Bunk
  2006-11-06 20:07 ` Michael Chan
  0 siblings, 1 reply; 3+ messages in thread
From: Adrian Bunk @ 2006-11-06  9:45 UTC (permalink / raw)
  To: jgarzik, davem; +Cc: netdev, linux-kernel

The Coverity checker noted the following in drivers/net/tg3.c:

<--  snip  -->

...
static void __devinit tg3_read_partno(struct tg3 *tp)
{
        unsigned char vpd_data[256];
        int i;
...
        /* Now parse and find the part number. */
        for (i = 0; i < 256; ) {
                unsigned char val = vpd_data[i];
                int block_end;

                if (val == 0x82 || val == 0x91) {
                        i = (i + 3 +
                             (vpd_data[i + 1] +
                              (vpd_data[i + 2] << 8)));
                        continue;
                }

                if (val != 0x90)
                        goto out_not_found;

                block_end = (i + 3 +
                             (vpd_data[i + 1] +
                              (vpd_data[i + 2] << 8)));
                i += 3;
...

<--  snip  -->

The problem is that vpd_data[i + 2] could be vpd_data[255 + 2].

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-11-07 22:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-06  9:45 tg3_read_partno(): possible array overrun Adrian Bunk
2006-11-06 20:07 ` Michael Chan
2006-11-07 22:58   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).