diff options
author | ru <ru@FreeBSD.org> | 2005-12-01 21:18:04 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2005-12-01 21:18:04 +0000 |
commit | c1d43a60c3b01e74a96a2acb45e648258f9bba69 (patch) | |
tree | b47d163f831e50415e615fed40faa2f0fa75c15e | |
parent | 1b3a7d3baf79566622b6b58ab60a568896ff4d34 (diff) | |
download | FreeBSD-src-c1d43a60c3b01e74a96a2acb45e648258f9bba69.zip FreeBSD-src-c1d43a60c3b01e74a96a2acb45e648258f9bba69.tar.gz |
Fix the type of "eaddr" to guarantee the required alignment.
Suggested by: marcel
-rw-r--r-- | sys/dev/de/if_de.c | 16 | ||||
-rw-r--r-- | sys/pci/if_de.c | 16 |
2 files changed, 16 insertions, 16 deletions
diff --git a/sys/dev/de/if_de.c b/sys/dev/de/if_de.c index feaedac..3ad22d3 100644 --- a/sys/dev/de/if_de.c +++ b/sys/dev/de/if_de.c @@ -3023,7 +3023,7 @@ tulip_addr_filter(tulip_softc_t * const sc) struct ifmultiaddr *ifma; struct ifnet *ifp; u_char *addrp; - u_char eaddr[ETHER_ADDR_LEN]; + u_int16_t eaddr[ETHER_ADDR_LEN/2]; int multicnt; TULIP_LOCK_ASSERT(sc); @@ -3086,12 +3086,12 @@ tulip_addr_filter(tulip_softc_t * const sc) hash = tulip_mchash(ifp->if_broadcastaddr); sp[hash >> 4] |= htole32(1 << (hash & 0xF)); if (sc->tulip_flags & TULIP_WANTHASHONLY) { - hash = tulip_mchash(eaddr); + hash = tulip_mchash((caddr_t)eaddr); sp[hash >> 4] |= htole32(1 << (hash & 0xF)); } else { - sp[39] = TULIP_SP_MAC(((u_int16_t *)eaddr)[0]); - sp[40] = TULIP_SP_MAC(((u_int16_t *)eaddr)[1]); - sp[41] = TULIP_SP_MAC(((u_int16_t *)eaddr)[2]); + sp[39] = TULIP_SP_MAC(eaddr[0]); + sp[40] = TULIP_SP_MAC(eaddr[1]); + sp[41] = TULIP_SP_MAC(eaddr[2]); } } } @@ -3123,9 +3123,9 @@ tulip_addr_filter(tulip_softc_t * const sc) * Pad the rest with our hardware address */ for (; idx < 16; idx++) { - *sp++ = TULIP_SP_MAC(((u_int16_t *)eaddr)[0]); - *sp++ = TULIP_SP_MAC(((u_int16_t *)eaddr)[1]); - *sp++ = TULIP_SP_MAC(((u_int16_t *)eaddr)[2]); + *sp++ = TULIP_SP_MAC(eaddr[0]); + *sp++ = TULIP_SP_MAC(eaddr[1]); + *sp++ = TULIP_SP_MAC(eaddr[2]); } } IF_ADDR_UNLOCK(ifp); diff --git a/sys/pci/if_de.c b/sys/pci/if_de.c index feaedac..3ad22d3 100644 --- a/sys/pci/if_de.c +++ b/sys/pci/if_de.c @@ -3023,7 +3023,7 @@ tulip_addr_filter(tulip_softc_t * const sc) struct ifmultiaddr *ifma; struct ifnet *ifp; u_char *addrp; - u_char eaddr[ETHER_ADDR_LEN]; + u_int16_t eaddr[ETHER_ADDR_LEN/2]; int multicnt; TULIP_LOCK_ASSERT(sc); @@ -3086,12 +3086,12 @@ tulip_addr_filter(tulip_softc_t * const sc) hash = tulip_mchash(ifp->if_broadcastaddr); sp[hash >> 4] |= htole32(1 << (hash & 0xF)); if (sc->tulip_flags & TULIP_WANTHASHONLY) { - hash = tulip_mchash(eaddr); + hash = tulip_mchash((caddr_t)eaddr); sp[hash >> 4] |= htole32(1 << (hash & 0xF)); } else { - sp[39] = TULIP_SP_MAC(((u_int16_t *)eaddr)[0]); - sp[40] = TULIP_SP_MAC(((u_int16_t *)eaddr)[1]); - sp[41] = TULIP_SP_MAC(((u_int16_t *)eaddr)[2]); + sp[39] = TULIP_SP_MAC(eaddr[0]); + sp[40] = TULIP_SP_MAC(eaddr[1]); + sp[41] = TULIP_SP_MAC(eaddr[2]); } } } @@ -3123,9 +3123,9 @@ tulip_addr_filter(tulip_softc_t * const sc) * Pad the rest with our hardware address */ for (; idx < 16; idx++) { - *sp++ = TULIP_SP_MAC(((u_int16_t *)eaddr)[0]); - *sp++ = TULIP_SP_MAC(((u_int16_t *)eaddr)[1]); - *sp++ = TULIP_SP_MAC(((u_int16_t *)eaddr)[2]); + *sp++ = TULIP_SP_MAC(eaddr[0]); + *sp++ = TULIP_SP_MAC(eaddr[1]); + *sp++ = TULIP_SP_MAC(eaddr[2]); } } IF_ADDR_UNLOCK(ifp); |