From 14e60aaece20a1cfc059a69f6491b0899f9257a8 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Thu, 16 Jun 2016 18:17:26 +0100 Subject: hw/net/e1000: Don't use *_to_cpup() Don't use *_to_cpup() to do byte-swapped loads; instead use ld*_p() which correctly handle misaligned accesses. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Acked-by: Jason Wang Acked-by: Dmitry Fleytman > Message-id: 1466097446-981-6-git-send-email-peter.maydell@linaro.org --- hw/net/e1000x_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hw/net/e1000x_common.c') diff --git a/hw/net/e1000x_common.c b/hw/net/e1000x_common.c index 94f85c98c8..eb0e097137 100644 --- a/hw/net/e1000x_common.c +++ b/hw/net/e1000x_common.c @@ -47,7 +47,7 @@ bool e1000x_rx_ready(PCIDevice *d, uint32_t *mac) bool e1000x_is_vlan_packet(const uint8_t *buf, uint16_t vet) { - uint16_t eth_proto = be16_to_cpup((uint16_t *)(buf + 12)); + uint16_t eth_proto = lduw_be_p(buf + 12); bool res = (eth_proto == vet); trace_e1000x_vlan_is_vlan_pkt(res, eth_proto, vet); -- cgit 1.4.1