From nobody Sat May 30 10:53:10 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1778007164; cv=none; d=zohomail.com; s=zohoarc; b=VIIIf6QCZ74hEcTM2m0mhfNcAoHrHkIVCWgz6/KfRoagKamhfHi+Awl2KGnuRhWu2+4hSapz8lDmKdjWTn7s/z5Gb9CRv142z4cq651HBe2sdxAAKvMm+gG3f1C3TLAZjG4WwiR0Cx8rWK+CCZ/bNrUGmfmfpEQFmKmiITeavL8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778007164; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=YZnBv5rFSKGwhe+faoJren4bCvjBLrz7mCkkLHBPgiE=; b=SNRsdhN7E2Xrs0ggntdTMBxIHgYK5fls+SrcJfqUyy4Av5wayzuF/rL4GljOf9Er/4vNJJK4ZjlLkdw9AS9aZczl12INWktkh7jUp/8IBRCu/fWOw4nz/mckQeZq2XnEoHcz5Te9fbAnhagdGaI/4nSkjt91wMcH4TeNdC3r3HU= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177800716415167.43982320112548; Tue, 5 May 2026 11:52:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wKKsi-0002xx-Vf; Tue, 05 May 2026 14:52:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wKKsH-0002hZ-P5 for qemu-devel@nongnu.org; Tue, 05 May 2026 14:52:12 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wKKsE-0007AK-G8 for qemu-devel@nongnu.org; Tue, 05 May 2026 14:52:04 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-44e1ebb3122so1311685f8f.2 for ; Tue, 05 May 2026 11:52:01 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48a8eb6ffb7sm377086675e9.5.2026.05.05.11.51.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 May 2026 11:51:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1778007120; x=1778611920; darn=nongnu.org; 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=YZnBv5rFSKGwhe+faoJren4bCvjBLrz7mCkkLHBPgiE=; b=PL2HtD09yEzjPj36uZE7oGQ+Ho2hvGJkPxM6h0BravV3oOf0ss4U5EASYJRa+8Phic +4wWC0Qdz2zOGU6OUexj56PojiakxO0s552zbWUzhoi35WCK0GrhHIzBpPzjm2nk81SA NzL8hgRBFlTipON8bEpdPg08DAtrsPy8F8ZkD5I/ULUetQnvajEtTDFyXYVOEDQv1uGq ARXAIqFEzZzaVwy/qJaLmzQ8VAHJ8UsW+dGrz+wIATkxDIJVzwPQy0/4pf0UWP7Oxr9W HbHpYTOLvs9nwvJWau4g+bmywiDMSvZLG38s1WQCJbmbEYeRUfLD7hfs4ywOHs0FMimG KPQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778007120; x=1778611920; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=YZnBv5rFSKGwhe+faoJren4bCvjBLrz7mCkkLHBPgiE=; b=tWmjJF3VL8wtPNh3u4wjBVPijsbfx9ocQWPsnrnD/4eIlxhClUnz/bB1vYDW03CeEt dNHC1yxbBGrEMvTiLxiKnBtITWKzT/uejeQJ8nmsbvCfCZxmh5b7s0fY2jcV6gng4gTw 6it8piU3JayTrABS1FSon6NgtraJIkN8bzk+yd7aDEGqqjzmxIfgAp9RgPrbbCm6VyYd mQBOF2BvhVFGCj5lZhEUkCbHAmsr+kAOvkB136DhY2/G5hyUngCHvI+kcS1q1PaGbSyz cgbZjZ6nV4dqJx8fX6nM6Tqg91pIUXO+wqkNoYEXhNFijzfb/nJtiunqKAV4bVyVvm2G n/HQ== X-Gm-Message-State: AOJu0YwjxY5ecndIerKjSYfwQ87AaayIuNQM9nla8kiFgg3XdQ1Xpc03 ygL85pJ/83AXOfWyoQdeoJIsEKUjGQKnefdDzuDFNkXmh94SPCZNwsDBM3EMLL/6B+qkWEv4nYJ M5HM3 X-Gm-Gg: AeBDieupNqKT3HbXbpn+yvlJ29ujQM/OhHyb4R59DcbDBjd6QX2RazCflr32H4TREsQ ThM99B7hfIkgQciQ6iu1d4HP6j6GREKCCqvwyiiqC/87/sqhi1WYjKMlXpd02IVjTFRg0h1Mpsy vJhEqMil3JD1BMrQPqwqhiAdlttdpmaSkOTc3GIFtWFK68NAdTiGcexQfS/KRXnudnXSVUgPJvm cFmDA4skb0sqE5r9a3CtIVCM4VE96I2QgJSFkFz20U39H/hhUb1EMqEcQn17gaoWM51hbayoaPZ BlJAjVvowoMPsBWMH3lUye/Y42VDaWWCQdcgxmBR46eF35pzRNKv/KM1hs81vyczx4gYh5sHJhV 1U65jBC2HNvK/I/owYBAg2Y0OzTND+UC7VXQfbK7/x3VkxTGQSDyZkUWRawD1OfATzQpDsroHp8 ySiogacAKYhV1PCGw/4c1wAcrcuYs2PMB5MFjz4QGDZwQKuhtbSigpkoCH+5t9Bgk4TALVbBYgE vLrSaasA7u7iKQklwJIAtwARIEQZCKVpRxjPdXP4SbS1bjafuH/ X-Received: by 2002:a05:600c:c11c:b0:488:a723:ea53 with SMTP id 5b1f17b1804b1-48e51f5398emr5175595e9.7.1778007119839; Tue, 05 May 2026 11:51:59 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: Jiri Pirko , Jason Wang Subject: [PATCH 1/2] hw/net/rocker_of_dpa: Check group ID pointers are not NULL Date: Tue, 5 May 2026 19:51:56 +0100 Message-ID: <20260505185157.608910-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260505185157.608910-1-peter.maydell@linaro.org> References: <20260505185157.608910-1-peter.maydell@linaro.org> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: qemu development 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 @linaro.org) X-ZM-MESSAGEID: 1778007165442154100 Content-Type: text/plain; charset="utf-8" In of_dpa_cmd_add_l2_flood(), we use rocker_tlv_parse_nested() to fill in a tlvs[] array. If the guest command is valid then the entries should be pointers to TLV data items with group IDs. However, if the guest gives us bogus data then rocker_tlv_parse_nested() indicates this by leaving the tlvs[] entries NULL. In the other places that use this function, we check for this before using the value, but here we forgot, and the result is that QEMU can crash: #0 __memcpy_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-v= ec-unaligned-erms.S:331 #1 0x00005555574f7137 in __asan_memcpy () #2 0x0000555558106792 in ldl_he_p (ptr=3D0x8) at /home/pm215/qemu/include/= qemu/bswap.h:278 #3 0x0000555558106755 in ldl_le_p (ptr=3D0x8) at /home/pm215/qemu/include/= qemu/bswap.h:311 #4 0x00005555580f85ed in rocker_tlv_get_le32 (tlv=3D0x0) at ../../hw/net/r= ocker/rocker_tlv.h:114 #5 0x000055555810a8ad in of_dpa_cmd_add_l2_flood (of_dpa=3D0x506000082e38,= group=3D0x503000b4e440, group_tlvs=3D0x7fff68702c20) at ../../hw/net/rocker/rocker_of_dpa.c:2032 #6 0x0000555558108a74 in of_dpa_cmd_group_do (of_dpa=3D0x506000082e38, gro= up_id=3D1073741824, group=3D0x503000b4e440, group_tlvs=3D0x7fff68702c20) at ../../hw/net/rocker/rocker_of_dpa.c:2115 #7 0x0000555558108730 in of_dpa_cmd_group_add (of_dpa=3D0x506000082e38, gr= oup_id=3D1073741824, group_tlvs=3D0x7fff68702c20) at ../../hw/net/rocker/rocker_of_dpa.c:2135 #8 0x00005555580f66ec in of_dpa_group_cmd (of_dpa=3D0x506000082e38, info=3D0x514000072e40, buf=3D0x5070002356c0 "= \001", cmd=3D7, group_tlvs=3D0x7fff68702c20) at ../../hw/net/rocker/rocker_of_dpa.c:2194 Check for NULL values and return an error. Cc: qemu-stable@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/1851 Signed-off-by: Peter Maydell --- hw/net/rocker/rocker_of_dpa.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/net/rocker/rocker_of_dpa.c b/hw/net/rocker/rocker_of_dpa.c index 3190a0e75c..958f3006c1 100644 --- a/hw/net/rocker/rocker_of_dpa.c +++ b/hw/net/rocker/rocker_of_dpa.c @@ -2029,6 +2029,10 @@ static int of_dpa_cmd_add_l2_flood(OfDpa *of_dpa, Of= DpaGroup *group, group_tlvs[ROCKER_TLV_OF_DPA_GROUP_IDS]); =20 for (i =3D 0; i < group->l2_flood.group_count; i++) { + if (!tlvs[i + 1]) { + err =3D -ROCKER_EINVAL; + goto err_out; + } group->l2_flood.group_ids[i] =3D rocker_tlv_get_le32(tlvs[i + 1]); } =20 --=20 2.43.0 From nobody Sat May 30 10:53:10 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1778007187; cv=none; d=zohomail.com; s=zohoarc; b=cZyFux0iXl24q5jm70Bhy88u2ehRenSz0i6sNVzMRLPfnI6vpnj28hGhtLGGUTjtrG4g8XgD8hLKqK00Jh2F1CbGowqCqpeUjrkiey6v3NU/kwb0awdMwtweAv/VimHKib2TeK5Rvn0RzBTWLNV+LS1riRwKyB2HVAD4mbHr6aI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778007187; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wyvNlrhCDRRoXpiivbyJr1JUobLzjlCgnPIPMN8niGU=; b=K4m3uV0hJP2MDhM+08eFDrWuVY0OK4eRn94EwaGp1d66ir6Jtk6ZTZ3ruPsfmCUDpUT8tJveaa1WE3XR5422DLlz0i1ufTiEqyFz14MdGVjJnYr0TJ69SGrKEGpw2RXbzbhUa0r6LGtpicwo/5VFFi+rWZfc9PMfAuw/y6/m6iY= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177800718718141.151019831668236; Tue, 5 May 2026 11:53:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wKKsv-00037M-Lf; Tue, 05 May 2026 14:52:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wKKsI-0002hw-6Y for qemu-devel@nongnu.org; Tue, 05 May 2026 14:52:12 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wKKsF-0007Aa-Ep for qemu-devel@nongnu.org; Tue, 05 May 2026 14:52:05 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-488a9033b2cso49794535e9.2 for ; Tue, 05 May 2026 11:52:02 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48a8eb6ffb7sm377086675e9.5.2026.05.05.11.51.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 May 2026 11:52:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1778007121; x=1778611921; darn=nongnu.org; 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=wyvNlrhCDRRoXpiivbyJr1JUobLzjlCgnPIPMN8niGU=; b=e8TDMAC8hdMUCiKLjoTALciievk2cGh+1TGnB05PvLBeJrxTUHcLUa/9Z52XG1eu1n aB1nY+A6q3LTRWoVSoUguoLD4OjKOSq2xtNnh3MNDQaUA06GBex6l4N+5iPCf/oSX1/p cTpcX9KJBF3dW44RpRKofB+AZY/VTk09eSOFxrCtSegNK5MqugFxcYSoElwJ0xDdJQRJ 0yGSc5lyEMo5KpvLERF3E9AjFgQGEDPDr0hlBYt6AUw5ovbeCaVozXIOhUjaR+m1t2lK WCB0d4uEpXUzz5To8bR+NfipzXpfIyKxJlO4SJb8QtOnCwrcUpGtlVKJOtR9b0vfCE8P OxXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778007121; x=1778611921; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=wyvNlrhCDRRoXpiivbyJr1JUobLzjlCgnPIPMN8niGU=; b=o6rEoZSxCpTfNVH2D7/0eRaJcc46hr5T43fVUtlC0b9BnthVzsTIdAQnmnngcq6SO9 IyEV/hBBjjOpCoh+LytKvAbhD+HB1RewMsXU34rGtVK5pW+zj31xW12MYmCyQFxdQ1J8 0GmM1TeIDktOvwDxYh4QOUCjN7yqpBqTwB6micsJ8SdhLqjpUS4eV5BNH0HFDLr3YKPS 8UuA6EZsbpAM7ewtJmTCyPrHXYXqhil9b6D/K5oKTfOY9FkXY6vRTyW4/xhzIQfBxdBW rbcw3YFlIBXvdquGGoGAQrBeZnEuQUEj0W5HtRcDx4kntwQttsnULhaAHdffMrTPHpq9 bM8Q== X-Gm-Message-State: AOJu0YxQV+XjBU9xMQ/A65tcb6kYJXUtEAvXDGjjwpNO8nBvO2eTxNNT ZKLzis6/H59XzxX9k5lLZ0DS8oL2l41TniRfVXaPgEKeT6PkE9hlUU23+M98xq0pTpVnw9miXd6 bB0Ir X-Gm-Gg: AeBDiesRbgbvHbJVqmeyq8XH73MMB1jhs4V2lUovfK2KzLQUUg8kz+6Z8L44hWvAoPW /qEV2wbDhHEQO69AQ8AkKj5qZuHRTTOiJ6AEwuJuSDXmz+bl8IVjRiA+vZFq99xar+XTn8gWwaG ahiN8C7ggZfLqEn7gS/L85YGk5ajmdkjjVBq+ixg+9O/bImnXHjdUlSPs3t3j/ryzOXfSdp7Coy fVMtwlQwhDW6jMHYr+02AITPwBU3UvLQiAkWXgemaANdFbNDyeXjr1om4GdSaGr2HykR+t4/6zi YR0GANaNB2o7EtmRci/ZBNpPhNx4C12N3OuYj+m0bN0QmT58Ky5DhceHRdbZtRe+saUdf6nX7vt GMZ8yZDzYtqmTpKpCKSH+PF8VpmBrBdY8KdaZNAfhThzpsolhsV+Z5Fc9In+ZS42krRwCOFoYzz /OocHieDPF6JkaOWhTCuXYY/8aOC/5fWsuLf9VS4KaCCfKbioJUaOMaM3by1GnKy3qWzcWwS1HD 1glF45jb70VTIMPxABuk/xH9TFXfG2N+iGCpPjGpA== X-Received: by 2002:a05:600c:1f0d:b0:48a:93d2:60d2 with SMTP id 5b1f17b1804b1-48e51dd9772mr8473475e9.0.1778007120740; Tue, 05 May 2026 11:52:00 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: Jiri Pirko , Jason Wang Subject: [PATCH 2/2] hw/net/rocker_of_dpa: Avoid unaligned accesses in _of_dpa_flow_match() Date: Tue, 5 May 2026 19:51:57 +0100 Message-ID: <20260505185157.608910-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260505185157.608910-1-peter.maydell@linaro.org> References: <20260505185157.608910-1-peter.maydell@linaro.org> 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: qemu development 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 @linaro.org) X-ZM-MESSAGEID: 1778007189678154100 Content-Type: text/plain; charset="utf-8" _of_dpa_flow_match() tries to do masked comparisons of OfDpaFlowkey structs by casting pointers to them to uint64_t* and then doing the memory accesses as 64-bit. This is undefined behaviour because the pointers might not be 64-bit aligned, and the UB sanitizer spots this: ../../hw/net/rocker/rocker_of_dpa.c:321:20: runtime error: load of misalign= ed address 0x512000164044 for type 'uint64_t' (aka 'unsigned long'), which = requires 8 byte alignment 0x512000164044: note: pointer points here 02 00 00 00 00 00 ff ff 00 00 00 00 ff ff ff ff 00 00 00 00 00 00 00 00= 00 00 00 00 00 00 00 00 ^ We do know that OfDpaFlowKey structs must be at least aligned enough for uint32_t accesses, because that's the type of the first field. Switch to using uint32_t accesses in the loop. Because the "width" field is always set via the FLOW_KEY_WIDTH macro and not exposed to the guest, we can adjust the macro to store the number of uint32_t to be checked rather than needing to change the loop boundary in the match function. Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell --- hw/net/rocker/rocker_of_dpa.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/net/rocker/rocker_of_dpa.c b/hw/net/rocker/rocker_of_dpa.c index 958f3006c1..3d6f55b512 100644 --- a/hw/net/rocker/rocker_of_dpa.c +++ b/hw/net/rocker/rocker_of_dpa.c @@ -99,13 +99,13 @@ typedef struct of_dpa_flow_key { } nd; } ipv6; }; - int width; /* how many uint64_t's in key? */ + int width; /* how many uint32_t's in key? */ } OfDpaFlowKey; =20 -/* Width of key which includes field 'f' in u64s, rounded up */ +/* Width of key which includes field 'f' in u32s, rounded up */ #define FLOW_KEY_WIDTH(f) \ DIV_ROUND_UP(offsetof(OfDpaFlowKey, f) + sizeof_field(OfDpaFlowKey, f)= , \ - sizeof(uint64_t)) + sizeof(uint32_t)) =20 typedef struct of_dpa_flow_action { uint32_t goto_tbl; @@ -304,9 +304,9 @@ static void _of_dpa_flow_match(void *key, void *value, = void *user_data) { OfDpaFlow *flow =3D value; OfDpaFlowMatch *match =3D user_data; - uint64_t *k =3D (uint64_t *)&flow->key; - uint64_t *m =3D (uint64_t *)&flow->mask; - uint64_t *v =3D (uint64_t *)&match->value; + uint32_t *k =3D (uint32_t *)&flow->key; + uint32_t *m =3D (uint32_t *)&flow->mask; + uint32_t *v =3D (uint32_t *)&match->value; int i; =20 if (flow->key.tbl_id =3D=3D match->value.tbl_id) { --=20 2.43.0