diff options
author | imp <imp@FreeBSD.org> | 2009-04-18 04:45:02 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2009-04-18 04:45:02 +0000 |
commit | 1b4076a052efb7ea4906d26727ab49c4dee99059 (patch) | |
tree | 1b9a5caaf07ce185eda66e40d16abb65c132b2c2 /sys/dev/ed | |
parent | f074d448cbb264ac20338d15eb1bfc653d046341 (diff) | |
download | FreeBSD-src-1b4076a052efb7ea4906d26727ab49c4dee99059.zip FreeBSD-src-1b4076a052efb7ea4906d26727ab49c4dee99059.tar.gz |
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...
Diffstat (limited to 'sys/dev/ed')
-rw-r--r-- | sys/dev/ed/if_ed_pccard.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/dev/ed/if_ed_pccard.c b/sys/dev/ed/if_ed_pccard.c index ab1b1b9..4db2fcf 100644 --- a/sys/dev/ed/if_ed_pccard.c +++ b/sys/dev/ed/if_ed_pccard.c @@ -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 *enaddr) 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); |