Subject: potential overflow in de4x5.c

From: Dan Carpenter <[email-masked]>
Date: Sun, 3 Jan 2010 12:13:56 +0200

Hi I found this using smatch (http://repo.or.cz/w/smatch.git).

drivers/net/tulip/de4x5.c
  4772          lp->active = *p++;
  4773          if (MOTO_SROM_BUG) lp->active = 0;
  4774          lp->phy[lp->active].gep = (*p ? p : NULL); p += (2 * (*p) + 1);

lp->phy is an array of size 8.

MOTO_SROM_BUG is defined like this. 

#define MOTO_SROM_BUG    (lp->active == 8 && (get_unaligned_le32(dev->dev_addr) & 0x00ffffff) == 0x3e0008)

If lp->active == 8 then we have a buffer overflow.

regards,
dan carpenter