From 77944b355129296fee1df686c610168d15b4bbb2 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sat, 18 Apr 2009 04:45:02 +0000 Subject: [PATCH] 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... --- sys/dev/ed/if_ed_pccard.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/dev/ed/if_ed_pccard.c b/sys/dev/ed/if_ed_pccard.c index ab1b1b9848e..4db2fcf9976 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);