From patchwork Wed Dec 26 03:42:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 154514 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5431444ljp; Tue, 25 Dec 2018 19:44:31 -0800 (PST) X-Google-Smtp-Source: ALg8bN5UzhZiI0dIYeiVgSnuIYxRF7XE851m1TujYtZFuNvCE654XBV5nxZ7NzjGG9UN909lFIZj X-Received: by 2002:a0c:d0d7:: with SMTP id b23mr17068403qvh.67.1545795871861; Tue, 25 Dec 2018 19:44:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545795871; cv=none; d=google.com; s=arc-20160816; b=mKj3gFq12R/v8pBfwqejitj+Kh3X+rWzUAcxZAg1WX3xlw5e4sLyZgdDEtqq/wXnVV jduwySlZVjCKYNWa6TAVVY+N1OojhHebmApD7fh2hOTLW7CT3HPBwyctikJIcoD17SOB jf3/aOk9f1UTH4yFXi0Q/0w29+ZADg9gDjnBo2ypM3T8mcTDJudjNmaJbLDRevlU/brL ylzRDJw8OMgJTvt+hER9XuNphtgnmv902CWg8HWCzc4NiunSwtROCQQBsYhIqnOFjFn7 tm34+CZ3scHaFFV3zYitG1AvsxQT6oXdAPL7E+pxv287RzB0xVO8y5uFNY9sjqjQFJF8 J+XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:message-id:date:to:from :dkim-signature; bh=X9vjrAjJTTiV2J32ctXT2XU1Ly0JZEo8nmojzwAzH7Q=; b=UcxQpy7xeSheokh1Y71+YA+4EQdHA8ybZVQ3BmdqrohYsid0JDT91LFEDUA/FlePty 9rith3XETFY1vq/ucCf4qZhgNyPMWVInsDzFDySUZek4AbVz/6IFdFo1Rk2CSWz1TZRM qyp9KJd2YfzybH6BjotnRTv5kIJivJHrVKEOGX4ajrWr8TgdkH2Sb9BUbac1o4MtVdE8 myHsDDS4dVKwfxWwJ0IZkGyGYxLxu3CakXI/huNae+FbJmg8E10nBDDN0YD4fRJ02H3g g5PwcUTJWGaZq/WRAyvllIjubvMjKXY+RR1rQvyNTpOw/xOvDMdDZRFzJdo18D+cpGLy Jl1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YvgmP7o0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [208.118.235.17]) by mx.google.com with ESMTPS id 34si10576103qvq.116.2018.12.25.19.44.31 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 25 Dec 2018 19:44:31 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YvgmP7o0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:44280 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gc07T-0007r2-DN for patch@linaro.org; Tue, 25 Dec 2018 22:44:31 -0500 Received: from eggs.gnu.org ([208.118.235.92]:34751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gc06B-000705-7g for qemu-devel@nongnu.org; Tue, 25 Dec 2018 22:43:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gc066-0007Y4-6J for qemu-devel@nongnu.org; Tue, 25 Dec 2018 22:43:11 -0500 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:41513) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gc066-0007XS-0n for qemu-devel@nongnu.org; Tue, 25 Dec 2018 22:43:06 -0500 Received: by mail-pg1-x544.google.com with SMTP id m1so7067187pgq.8 for ; Tue, 25 Dec 2018 19:43:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=X9vjrAjJTTiV2J32ctXT2XU1Ly0JZEo8nmojzwAzH7Q=; b=YvgmP7o0mL7rqG/sIrDvGpgxtbSgHniEwyMhnlx535MOsRWfzdeFtf2J5DOe9mcwt7 280+q8LWU7/nUHoaqhuf+xkXdwxBKwQ2TF+5Bjq6oYYevoEmd7aZf01rT+Jck7ZWPTTs TCU1cjZpmKQlmpOvTOwUT1qzNmPgNpKh405eo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=X9vjrAjJTTiV2J32ctXT2XU1Ly0JZEo8nmojzwAzH7Q=; b=odjoOExf3RZX6hIi5wDIXZtxyzt4W3lA3JgZcjIhnf+VisGiIFDjjLGQ3j/eBiI/fB gYNz67wptvgXM4cR+eLQo+PEN6Vy17T/sS6HhWAbTB6H82nYmmsutSiryne9piFmPB8b /mNmgvfxr+bS7BcXC8Zw/GCg/4DNH1v17hUDdv8Dt0JCZN8JkEaSXd0JY9GFxcF/Ogc2 tCLnEGVzc3VRhmqT6pfSDtTREHzhK9kzFiKMUNHrCBF+33Kv9uZmGlwqy6ukU1QBEpSn 9jnW95PwWoUvTjb8aZxeNsmPce5mV2UvI95dsIueB6M/tNyull8sNXbrwLB70S/0yrGx pR/w== X-Gm-Message-State: AJcUukfJoXxGdlmxGvyjEr26o9gaeA+Ch12ttmRiK5p7sCTLk2EFhKKa ANjeObzvpNQ6yWKOplQwxkkeEY5v9Fk= X-Received: by 2002:a65:60c2:: with SMTP id r2mr17683306pgv.393.1545795784441; Tue, 25 Dec 2018 19:43:04 -0800 (PST) Received: from cloudburst.home (c211-28-135-144.sunsh3.vic.optusnet.com.au. [211.28.135.144]) by smtp.gmail.com with ESMTPSA id p7sm51042535pfa.22.2018.12.25.19.43.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Dec 2018 19:43:03 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 26 Dec 2018 14:42:54 +1100 Message-Id: <20181226034254.17842-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::544 Subject: [Qemu-devel] [PATCH] slirp: Use lduw_be_p in slirp_input X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: samuel.thibault@ens-lyon.org, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- slirp/slirp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.2 Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Samuel Thibault Reviewed-by: Richard Henderson 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);