qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] slirp: Use lduw_be_p in slirp_input
@ 2018-12-26  3:42 Richard Henderson
  2018-12-26 10:57 ` Peter Maydell
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Richard Henderson @ 2018-12-26  3:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: samuel.thibault, jan.kiszka

The pointer may be unaligned, so we must use our routines for that.
At the same time, we might as well use the big-endian version
instead of ntohs.

This fixes sparc64 host SIGBUS during pxe boot.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 slirp/slirp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/slirp/slirp.c b/slirp/slirp.c
index 322edf51eb..a116f43878 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -851,7 +851,7 @@ void slirp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len)
     if (pkt_len < ETH_HLEN)
         return;
 
-    proto = ntohs(*(uint16_t *)(pkt + 12));
+    proto = lduw_be_p(pkt + 12);
     switch(proto) {
     case ETH_P_ARP:
         arp_input(slirp, pkt, pkt_len);
-- 
2.17.2

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-01-23 11:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-26  3:42 [Qemu-devel] [PATCH] slirp: Use lduw_be_p in slirp_input Richard Henderson
2018-12-26 10:57 ` Peter Maydell
2018-12-26 11:04 ` Philippe Mathieu-Daudé
2019-01-16 23:50 ` Samuel Thibault
2019-01-17  0:05   ` Richard Henderson
2019-01-17 13:16   ` Philippe Mathieu-Daudé
2019-01-17 13:22     ` Samuel Thibault
2019-01-17 13:56     ` Peter Maydell
2019-01-18 11:25       ` Marc-André Lureau
2019-01-18 11:37         ` Marc-André Lureau
2019-01-18 11:54           ` Peter Maydell
2019-01-23 11:29 ` no-reply

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).