Skip to content

Commit

Permalink
b44: Truncate PHY address
Browse files Browse the repository at this point in the history
Some ROMs on embedded devices store incorrect values for
the PHY address of the ethernet device.
It looks like the number is sign-extended.
Truncate the value by applying the PHY-address mask to it.
The patch was tested on a bcm47xx embedded system (where the bug
triggers) and a bcm4400 PCI card.

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
  • Loading branch information
Michael Buesch authored and Jeff Garzik committed Mar 26, 2008
1 parent 6ef2977 commit 5ea7963
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/net/b44.c
Original file line number Diff line number Diff line change
Expand Up @@ -2082,6 +2082,11 @@ static int __devinit b44_get_invariants(struct b44 *bp)
addr = sdev->bus->sprom.et0mac;
bp->phy_addr = sdev->bus->sprom.et0phyaddr;
}
/* Some ROMs have buggy PHY addresses with the high
* bits set (sign extension?). Truncate them to a
* valid PHY address. */
bp->phy_addr &= 0x1F;

memcpy(bp->dev->dev_addr, addr, 6);

if (!is_valid_ether_addr(&bp->dev->dev_addr[0])){
Expand Down

0 comments on commit 5ea7963

Please sign in to comment.