svn commit: r191238 - head/sys/dev/ed
Warner Losh
imp at FreeBSD.org
Sat Apr 18 04:45:03 UTC 2009
Author: imp
Date: Sat Apr 18 04:45:02 2009
New Revision: 191238
URL: http://svn.freebsd.org/changeset/base/191238
Log:
Make sure that the data in the ROM with a valid signature isn't all
0's. At least one PC Card ASIC does this...
Modified:
head/sys/dev/ed/if_ed_pccard.c
Modified: head/sys/dev/ed/if_ed_pccard.c
==============================================================================
--- head/sys/dev/ed/if_ed_pccard.c Sat Apr 18 04:37:53 2009 (r191237)
+++ head/sys/dev/ed/if_ed_pccard.c Sat Apr 18 04:45:02 2009 (r191238)
@@ -330,7 +330,7 @@ static int
ed_pccard_rom_mac(device_t dev, uint8_t *enaddr)
{
struct ed_softc *sc = device_get_softc(dev);
- uint8_t romdata[32];
+ uint8_t romdata[32], sum;
int i;
/*
@@ -371,6 +371,10 @@ ed_pccard_rom_mac(device_t dev, uint8_t
device_printf(dev, "ROM DATA: %32D\n", romdata, " ");
if (romdata[28] != 0x57 || romdata[30] != 0x57)
return (0);
+ for (i = 0, sum = 0; i < ETHER_ADDR_LEN; i++)
+ sum |= romdata[i * 2];
+ if (sum == 0)
+ return (0);
for (i = 0; i < ETHER_ADDR_LEN; i++)
enaddr[i] = romdata[i * 2];
return (1);
More information about the svn-src-all
mailing list