From nobody Wed Feb 11 03:04:57 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1682223995; cv=none; d=zohomail.com; s=zohoarc; b=ayhf1RId7QhTxrBDAjiT1T6F57QDRESb46kQeEZQ5CyOhbjW2f9YBRkoM7Kus1binOPego6UBkuBsKy0xNixlG0Ja8xMHOA3/E9rmQp7hbB4PIrL7LWY2jOtLgpScqajH9uWeUROpFAZlOTuWe1x3I8UlTv57Jt4WIIgAHiLzkk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682223995; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject; bh=8cbPtOGCt4/DtgDNQOMqkazCwuM1SU58VR9lfEcSjFg=; b=hlNNheZBjvM8lrcTrmQda60FXgBkm9/+Kbno43sMruuIE/Hbv06V/R52kuQEaZ5UFxz+0gWveL9FF0KUxJ91aA3ohoet1u6ZPydfiswcBnzEtwDe0EmY6dr2sgCCiJMxdpbt2kP1uS9RKdmHfZNVf6T54Mr9qLG7e9+HBg8cnIQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1682223995359442.20316490690186; Sat, 22 Apr 2023 21:26:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqRDd-0005vE-Ut; Sun, 23 Apr 2023 00:20:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqRDG-0004nj-F4 for qemu-devel@nongnu.org; Sun, 23 Apr 2023 00:20:39 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pqRDE-0001IR-US for qemu-devel@nongnu.org; Sun, 23 Apr 2023 00:20:34 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1a526aa3dd5so38192175ad.3 for ; Sat, 22 Apr 2023 21:20:32 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:4457:c267:5e09:481b]) by smtp.gmail.com with ESMTPSA id f1-20020a170902ff0100b001a5059861adsm4596996plj.224.2023.04.22.21.20.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 21:20:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682223632; x=1684815632; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8cbPtOGCt4/DtgDNQOMqkazCwuM1SU58VR9lfEcSjFg=; b=Xyq9IkcplEjVDq/bilWK2GW45k7/Vdhf9JhZMzSD14FiWmDvvqFUogNfmQJeMoxsDr STNqZVLyiUOVmylBIk9MXvKfVmykJicpAMeVhYk2rDeiTMa6NMglp0CX8ouY5MVhx5KS +7bweTDGzJgc4ONYeSTh9Z/RzzNV6uLcLmy2BL/TbUvzgAcDM8b4c3gFRxJWbjK/bads 8oGHvclRMheau7mwFcJWnYwJRzocVNLUzoFoUT60Bx+W0EV6Er6lr3Vv4Kt094912tvb ceLtROEOHwakKrgXTCFOQ46LZDpP2TJuGcOhvYSeJxPf5sKm1H5YEGO1x5MQKncaSaPe Zvrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682223632; x=1684815632; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8cbPtOGCt4/DtgDNQOMqkazCwuM1SU58VR9lfEcSjFg=; b=SRn9QPIZxJ9FHSrAwLhJ+ux9gxkYcPwOIKoEkJNJopFmpSmD1IhdsQnHmMn/tgN73w iPtKSdoXNiRkauyjNbPAhHtOiZz9Qjp29J06feui4LCFJAmptfejE7oLhOA2lXCmVybR uM1ckG5BjorSxm1HTR5snWeanuNbn+fOA+aOsstDKJmiMWxTHE/FOkTnOW5MEoG0Ki3F 574PGNu9n2T/U8tlSHxK/k51mwn/mD60KLF8ZqvzMaDRmZ4XmVLJw4UEh4uJ2XxIAdHv /6XV8VNg94Gnn0lwYThQYIrO0uEutH9PUc6zbd9Q96Cks9FJcV5R7n2GsFZ7Sc7oSAbI 2iKQ== X-Gm-Message-State: AAQBX9cmdWtj+qBozb7etT29UVKPlFjHdenNuxTkIrnT/B9Uv5tQGuPZ 2OU65WNEhzgKApxPO7rqIc9bug== X-Google-Smtp-Source: AKy350ZOvZ9H4O0BgZ38ZlI2K3qoLXFFjYqy+hw8mlCHqbW6+Tnwi+ygnz9MLNfInnYZkNzteAg7gQ== X-Received: by 2002:a17:902:d4cc:b0:1a6:b971:faf8 with SMTP id o12-20020a170902d4cc00b001a6b971faf8mr12545617plg.53.1682223631777; Sat, 22 Apr 2023 21:20:31 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v3 32/47] hw/net/net_rx_pkt: Enforce alignment for eth_header Date: Sun, 23 Apr 2023 13:18:18 +0900 Message-Id: <20230423041833.5302-33-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230423041833.5302-1-akihiko.odaki@daynix.com> References: <20230423041833.5302-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::629; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x629.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20221208.gappssmtp.com) X-ZM-MESSAGEID: 1682223997293100003 Content-Type: text/plain; charset="utf-8" eth_strip_vlan and eth_strip_vlan_ex refers to ehdr_buf as struct eth_header. Enforce alignment for the structure. Signed-off-by: Akihiko Odaki Reviewed-by: Sriram Yagnaraman --- hw/net/net_rx_pkt.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/hw/net/net_rx_pkt.c b/hw/net/net_rx_pkt.c index 6125a063d7..1de42b4f51 100644 --- a/hw/net/net_rx_pkt.c +++ b/hw/net/net_rx_pkt.c @@ -23,7 +23,10 @@ =20 struct NetRxPkt { struct virtio_net_hdr virt_hdr; - uint8_t ehdr_buf[sizeof(struct eth_header) + sizeof(struct vlan_header= )]; + struct { + struct eth_header eth; + struct vlan_header vlan; + } ehdr_buf; struct iovec *vec; uint16_t vec_len_total; uint16_t vec_len; @@ -89,7 +92,7 @@ net_rx_pkt_pull_data(struct NetRxPkt *pkt, if (pkt->ehdr_buf_len) { net_rx_pkt_iovec_realloc(pkt, iovcnt + 1); =20 - pkt->vec[0].iov_base =3D pkt->ehdr_buf; + pkt->vec[0].iov_base =3D &pkt->ehdr_buf; pkt->vec[0].iov_len =3D pkt->ehdr_buf_len; =20 pkt->tot_len =3D pllen + pkt->ehdr_buf_len; @@ -120,7 +123,7 @@ void net_rx_pkt_attach_iovec(struct NetRxPkt *pkt, assert(pkt); =20 if (strip_vlan) { - pkt->ehdr_buf_len =3D eth_strip_vlan(iov, iovcnt, iovoff, pkt->ehd= r_buf, + pkt->ehdr_buf_len =3D eth_strip_vlan(iov, iovcnt, iovoff, &pkt->eh= dr_buf, &ploff, &tci); } else { pkt->ehdr_buf_len =3D 0; @@ -142,7 +145,7 @@ void net_rx_pkt_attach_iovec_ex(struct NetRxPkt *pkt, =20 if (strip_vlan) { pkt->ehdr_buf_len =3D eth_strip_vlan_ex(iov, iovcnt, iovoff, vet, - pkt->ehdr_buf, + &pkt->ehdr_buf, &ploff, &tci); } else { pkt->ehdr_buf_len =3D 0; --=20 2.40.0