From nobody Sat Jul 25 07:03:16 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1784790186; cv=none; d=zohomail.com; s=zohoarc; b=A7wsm3NOVZr27lrSfoeMJlmrEv45zx1226uG0tGOhzKnByC49q7SqJJlXqnyk9r7U8SuIQaDi8gH4Mxx0yuCimwrqvMCABXUUbgtLz3yKoVIm9L0zrWV+r8B7+lk7+c03LTMgWWnif5VHnJefo1r8kgMnIOaPsSQWl7pkALpGbc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784790186; 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=W8/ql9oV4e6EQ7S+iz2MJkQ+GXmFiJkWowxvSQIx9Bc=; b=dv9HcMT3gwAP5T7hV7Yq60Cz974N0b5Hj96WexwguIOcPbXXrlCLATVr//JzZG0dJ2x+D/Vyy5W0sZtnwGerAPjcH2Mf5w9MRcS+rAiQ61Vj3/PdSHf5ST/6wtcv74K8pZSxJFJkjEuvSMUPVTRUdOf0vcYjWB0lOfkRUXaRmYE= 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 17847901863577.310094282713408; Thu, 23 Jul 2026 00:03:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wmnRW-00024w-1O; Thu, 23 Jul 2026 03:02:06 -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 1wmnRE-0001xD-Bt for qemu-devel@nongnu.org; Thu, 23 Jul 2026 03:01:57 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wmnRC-000424-6E for qemu-devel@nongnu.org; Thu, 23 Jul 2026 03:01:48 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-495590dde14so2854835e9.0 for ; Thu, 23 Jul 2026 00:01:45 -0700 (PDT) Received: from Provence.localdomain (dynamic-2a02-3100-29ed-6000-0219-99ff-feb2-2458.310.pool.telefonica.de. [2a02:3100:29ed:6000:219:99ff:feb2:2458]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f85c6dc25sm13293923f8f.33.2026.07.23.00.01.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2026 00:01:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784790104; x=1785394904; 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:content-type; bh=W8/ql9oV4e6EQ7S+iz2MJkQ+GXmFiJkWowxvSQIx9Bc=; b=OfnZ3+E9UaoshLf+hW59CLEH26rajSuY3YhrxNpLHqhbyJtu9eaLI5DlGXh5XpSPHg Uq/Lorad3B3k3ustHpw2Z9ZW0C1aV0YMVjz8I66l5BBHqabt5ns4JEH7XEoIzeYsaOaV WgljRqLk3G4zps0RTAxiUiCH7OswyZ37s2eWSTzz05i6vNKrHKxt/y18HuLVua3GbfPu 73QVzzGuU33x4TrdFfESBLK3qBoPfqEefPgvd7DdAig7M2yKiaGERxJ5XKoPvxggv0+c C1/ztRp9zvhTNzPiwWhyqyQW8mhqXuNGYDzhUfuODyg9T3AMDjrE28bL8/6LgCof22V0 Yoyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784790104; x=1785394904; 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:content-type; bh=W8/ql9oV4e6EQ7S+iz2MJkQ+GXmFiJkWowxvSQIx9Bc=; b=WQBEFdHAjkZb3h5vulJm7VCPpHDkT7rfAEfI8WMvvbU4dYeTfftuom6YizdK7Yhtjx zEy5mr9bvVwem9ev/gFL4LOn7/bgQWnTNA7iGucltTAE7si/+78Uc9XHXe4lc/b7Be1Q PkFsbO73zLeXAw7ekR7R+7VZvozRp71thLEYOMh/OwdHjLYntrNWCcV65DKGXL7OCfBK Wo6U+U2lOOFrZzy9h8J0Fw9VV7xWi7vAlqVzJzVgM6d8WQrWEjyvmM/lrjfGYvU3qywc 1O+f5k4uM0V658wg6DeApo4/aUA2wp0kjbxyV035egxieWYPPI9U1spnOij54HvQTiz2 PwLg== X-Gm-Message-State: AOJu0YyS+4Q++cpaqSRsD9K5qshx5zERGn/mdFo+WPY5Vglxo4mE1Ckq HOnPJCGgzGQRHXVSUvSodVlN0VbV74Ffk5COK1QykDvpo4NOJb1xC1rHzmrYpw== X-Gm-Gg: AR+sD10D/DQTncT2eKtYfijS7hXMoNS++PhNH8wmdueU7G1m/uvMBnZOPzXJDCuaAEg 4U1S3PtK7tSJHCm3BfBS5c+4oSDl4+zd4QVsycO3l8SNdA/4Pkptd8mAhFJofGMKU+Dp6EvUVwo JuTefB6YSqpQ7NNQ4tXbq6ag4wzpbHgG4P+siXQSy4aJvQAgwzJWciS3SjVYFtx/LVQeOWJtBI4 suOiiTzPHl/IkGowvMJZGOM+DxYA/DdR0Xj54nLPUdLK/hMHeS49hsk58uqCrXnPgIELTyL099h kHnBGuOYSmQSbXLXPucqGiuD220HBOxwK02kC5DRQlt7ed3y9ABaS5ZV1CIP5Hg1H+nf7XCh48v JV7EdUcflWImxd3qmy5idXqsjgGanxN8Yg9ITvlmNV4J20s1FTyidEbh28F1Lv1shO9xL+4Azqk W4nUYTqwNwOix9+8PEU9/sOQuiVH0P1wQXpC1wbsmYyfYprjP6mDb3CHFvF+rFKf0/oxlbak3qE 5B/W7DYFuF0fUl1srT+vT7bew== X-Received: by 2002:a05:6000:4108:b0:47f:8fc9:6eaa with SMTP id ffacd0b85a97d-47f8fc96f0cmr1598370f8f.8.1784790104073; Thu, 23 Jul 2026 00:01:44 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Pavel Pisa , Matyas Bobek , Francisco Iglesias , Jason Wang , Vikram Garhwal , Bernhard Beschow , Peter Maydell Subject: [PATCH 1/9] hw/net/can/flexcan: Use mbs[] array for FIFO pop Date: Thu, 23 Jul 2026 09:00:51 +0200 Message-ID: <20260723070059.6332-2-shentey@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723070059.6332-1-shentey@gmail.com> References: <20260723070059.6332-1-shentey@gmail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=shentey@gmail.com; helo=mail-wm1-x32d.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, FREEMAIL_FROM=0.001, 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 @gmail.com) X-ZM-MESSAGEID: 1784790187725158500 Content-Type: text/plain; charset="utf-8" Implement FIFO entry shifting using the underlying `mbs[]` array instead of the overlapping `fifo` union view. This makes it explicit that the operation copies within a contiguous mailbox array and avoids Coverity CID 1662971. Reported-by: Peter Maydell Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Pavel Pisa --- hw/net/can/flexcan.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/net/can/flexcan.c b/hw/net/can/flexcan.c index da36d10bd3..3a97edf7a4 100644 --- a/hw/net/can/flexcan.c +++ b/hw/net/can/flexcan.c @@ -879,22 +879,22 @@ static bool flexcan_can_receive(CanBusClientState *cl= ient) */ static void flexcan_fifo_pop(FlexcanState *s) { - if (s->regs.fifo.mb_back.can_ctrl !=3D 0) { + if (s->regs.mbs[0].can_ctrl !=3D 0) { /* move queue elements forward */ - memmove(&s->regs.fifo.mb_back, &s->regs.fifo.mbs_queue[0], - sizeof(s->regs.fifo.mbs_queue)); + memmove(&s->regs.mbs[0], &s->regs.mbs[1], + sizeof(s->regs.mbs[0]) * (FLEXCAN_FIFO_DEPTH - 1)); =20 /* clear the first-in slot */ memset(&s->regs.mbs[FLEXCAN_FIFO_DEPTH - 1], 0, sizeof(FlexcanRegsMessageBuffer)); =20 trace_flexcan_fifo_pop(DEVICE(s)->canonical_path, 1, - s->regs.fifo.mb_back.can_ctrl !=3D 0); + s->regs.mbs[0].can_ctrl !=3D 0); } else { trace_flexcan_fifo_pop(DEVICE(s)->canonical_path, 0, 0); } =20 - if (s->regs.fifo.mb_back.can_ctrl !=3D 0) { + if (s->regs.mbs[0].can_ctrl !=3D 0) { flexcan_irq_iflag_set(s, I_FIFO_AVAILABLE); } else { flexcan_irq_iflag_clear(s, I_FIFO_AVAILABLE); --=20 2.55.0 From nobody Sat Jul 25 07:03:16 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1784790180; cv=none; d=zohomail.com; s=zohoarc; b=RLyQN+KL3tN1xHJf6dhMVhENxK8rUW+bA3Y/DQS0p1gzaHCjIUaMi2mLitcAGItGlQRFE8e8kekjRRqBXGkHuAYb60TjgZuK08Mo4Y76LT1cpsIpJQoQqHDOahH8DKm+mRHeT4yuZyiQUGHFZgDRN6dyIxDTIeWIiGLg3IWzeQA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784790180; 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=82OS8GpNlBq/fjmhNi5hkKVwto7VKi4nd2Pa4nJKAqk=; b=XdoGPbVlJFF81xes1wtcOYywPCGB7FK4co6lvSjMS3jDRAItEX0G2vvIKCsQyuLPHPYU+xnAWbFyoPUz1AKyEP1oqoJ6gor3oSosNhO94/RNA08p90NWu1EDsHXsEebyFPfr/tnkFAXE/ny/KLdu/1zioIhjdDlUB0z4xQ1lFtA= 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 1784790180513655.5804899499625; Thu, 23 Jul 2026 00:03:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wmnRU-00023z-Cp; Thu, 23 Jul 2026 03:02:04 -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 1wmnRE-0001xE-Dn for qemu-devel@nongnu.org; Thu, 23 Jul 2026 03:01:57 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wmnRC-00042G-Vt for qemu-devel@nongnu.org; Thu, 23 Jul 2026 03:01:48 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-47f904e80eeso202452f8f.1 for ; Thu, 23 Jul 2026 00:01:46 -0700 (PDT) Received: from Provence.localdomain (dynamic-2a02-3100-29ed-6000-0219-99ff-feb2-2458.310.pool.telefonica.de. [2a02:3100:29ed:6000:219:99ff:feb2:2458]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f85c6dc25sm13293923f8f.33.2026.07.23.00.01.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2026 00:01:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784790105; x=1785394905; 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:content-type; bh=82OS8GpNlBq/fjmhNi5hkKVwto7VKi4nd2Pa4nJKAqk=; b=DkrUJzl6jZHX6zDRqdXnqxDj8hoTgoK/v1ouwKImXiVC6dAVk+81dlTIf36GivyJrM BGGMNPDImsL8TvMJQBOPEEPrwrnO016UDgnLtfFKULNzp0YRm/Y+EjhqoGFRXt5U+32D jww1OGU240xApxYR7Her1Dd/+iQOQLcUXAACO08NmcZ2DYpPlBGXMu51gfh+JYlm1Den Qs9VywC4yvFQ9V0dve77gwp325w0NyrLfmMe715fBTMWthlTkjbVYTJBmj02bmW+xWGs v/fjJgxWBYZ5soY69nH7Yxpx7uOp3LNDVycNg1ehTzh/R1wIJ93J5kPCzFswXYsuxZv9 KPSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784790105; x=1785394905; 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:content-type; bh=82OS8GpNlBq/fjmhNi5hkKVwto7VKi4nd2Pa4nJKAqk=; b=l5N5ffqIpY9EIcQy2QKun3Gc+TL8Kpp9XjPXbpcRR9sGBWeempXDjakiHrn7w2sV1l LPJQrBe8mOXTwbskeagSc31zOO5XcV/tATc9vl+5KCBNa7//qRoLQ/3ywmQo8N0+6omZ pbm+fzMxruG5hO6eptGAWp4lOrNPtaQQY/TB5vB4SO0HYB44zEwLstaJg8MydmF2kbg2 p0Hz0hgSl08fSt4iEawpcElzkkj9H1vfL36blVDUr9fgB7L6Du+1jA5wIbNvmHiJz+fO nmpIz4uggO1NbEOGgJNeO6XmWoRwHG3MfwtJn1vsbriyh239wn1n6LRDZcIUHLN70DOE 2log== X-Gm-Message-State: AOJu0YwJ8mrILTbvgml337sDYfS36jjuBNRsQ45eybJwipltKjPRfCFL OLQL/Q4CLdUHuk7IGt/4RgbHODDF9/sk7WUyvEejHV2m/Z4WBfP5oX/mrrISoA== X-Gm-Gg: AR+sD11cRXPVp3yuZZT999GkwubcSnZ7/oWLC7VLQq2XPzdTswU5olTpg4UMZFiWeOJ 7P3RgU8z12rRej9OYcYTHfwYmFdLALiICOUGzxR5uu6oii3JOrI2f+FD0LLxoZZch0wOSj1Mfsa kNPOD1MZCEP+jMSJHgKM32rLfaZmsQF928t61+STGwqyduyJEUSw8xF/RLqqptzShEbGGAG5sXt MmFtIoe4md9LTZmxpI7Owdi8xrHImym4gzhDVQDjd3zbPurCrhUO3BtwVRsY8PiAJW7RqfV/xzV VPhkTBBjc0FBIPGNGFt4Udckvl+a5cpCXrlRCbqGyVfytGoVOIttDEHlrVdpiCY/VpMRiCgEydF mJaisF02/YhXy0Ukyxx/UN7y7cd725YN42oEXxoH7w6laIllQzzlJRWFpCIws+BI4ALEpTcT4DM eIYiVLRWCubDtYEIiCMfpwYTzGQAlTrpsX8YVYWFiiJMYqLVl0YAqNbmGRH48aqTwFMP+lzsYd7 qGQhjzvVIDVVhYZFr+NW3ZIbwi78nDDTQl+ X-Received: by 2002:a05:6000:25e8:b0:47f:9235:4366 with SMTP id ffacd0b85a97d-47f923543bfmr533824f8f.49.1784790104959; Thu, 23 Jul 2026 00:01:44 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Pavel Pisa , Matyas Bobek , Francisco Iglesias , Jason Wang , Vikram Garhwal , Bernhard Beschow Subject: [PATCH 2/9] hw/net/flexcan: Drop unused RX FIFO register overlay Date: Thu, 23 Jul 2026 09:00:52 +0200 Message-ID: <20260723070059.6332-3-shentey@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723070059.6332-1-shentey@gmail.com> References: <20260723070059.6332-1-shentey@gmail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=shentey@gmail.com; helo=mail-wr1-x42b.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, FREEMAIL_FROM=0.001, 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 @gmail.com) X-ZM-MESSAGEID: 1784790182177158500 Content-Type: text/plain; charset="utf-8" Remove the unused `FlexcanRegsRXFifo` union view now that FIFO accesses use the underlying `mbs[]` array directly. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Pavel Pisa --- include/hw/net/flexcan.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/include/hw/net/flexcan.h b/include/hw/net/flexcan.h index 32de7b904a..d8159475e0 100644 --- a/include/hw/net/flexcan.h +++ b/include/hw/net/flexcan.h @@ -35,16 +35,6 @@ typedef struct FlexcanRegsMessageBuffer { uint32_t data[2]; } FlexcanRegsMessageBuffer; =20 -/* RX FIFO view of message buffer registers */ -typedef struct FlexcanRegsRXFifo { - /* 6 message buffer deep queue, queue back first */ - FlexcanRegsMessageBuffer mb_back; - FlexcanRegsMessageBuffer mbs_queue[FLEXCAN_FIFO_DEPTH - 1]; - - /* number of filter elements active depends on ctrl2 | FLEXCAN_CTRL2_R= FFN */ - uint32_t filter_table_els[128]; -} FlexcanRegsRXFifo; - /* FlexCAN register in hw layout */ typedef struct FlexcanRegs { uint32_t mcr; /* 0x00 */ @@ -78,7 +68,6 @@ typedef struct FlexcanRegs { union { /* 0x80 - not affected by soft reset */ uint32_t mb[sizeof(FlexcanRegsMessageBuffer) * FLEXCAN_MAILBOX_COU= NT]; FlexcanRegsMessageBuffer mbs[FLEXCAN_MAILBOX_COUNT]; - FlexcanRegsRXFifo fifo; }; uint32_t _reserved4[256]; /* 0x480 */ uint32_t rximr[64]; /* 0x880 - not affected by soft reset */ --=20 2.55.0 From nobody Sat Jul 25 07:03:16 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1784790174; cv=none; d=zohomail.com; s=zohoarc; b=M1xpqMTmn+0MpiPvASSsctRPjsGSzVEktUf6w/eNCYnOZnnnh22Rjm4mXKjrbDPCZKhvMuLxZ9zwbiCjAfLIj4aaZXxGOXqlq6mdprsr54r15q67FQfc3tQqj9QvKWcBkWI2g1tvHfq0bqhQ6LNWtUQNhDjfHMQ18kXd3efKK88= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784790174; 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=njXFzolhxF9m8wpOePYV3zpTWlWb14dNREPPOWvkdSc=; b=ZqPnZxenVEezMKabvY7O6D6qQi2ltXwYiBI1iO9qbAk5+fTH/DjaUNi4u2g4iejsCGMXd96DluY1K4kHJrHFfQbCAyAsBVJ883TbRwDqCWC4mEYz572XvK5Iv3hRRb5NlDibiIMBDH0NuQc6mVEBI9DY3eUIvZGGdT17o76ABzY= 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 1784790174689378.2625416691516; Thu, 23 Jul 2026 00:02:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wmnRT-00023F-PF; Thu, 23 Jul 2026 03:02:03 -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 1wmnRF-0001xM-Dq for qemu-devel@nongnu.org; Thu, 23 Jul 2026 03:01:57 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wmnRD-00042X-JM for qemu-devel@nongnu.org; Thu, 23 Jul 2026 03:01:49 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-49555a0e68bso1202805e9.2 for ; Thu, 23 Jul 2026 00:01:47 -0700 (PDT) Received: from Provence.localdomain (dynamic-2a02-3100-29ed-6000-0219-99ff-feb2-2458.310.pool.telefonica.de. [2a02:3100:29ed:6000:219:99ff:feb2:2458]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f85c6dc25sm13293923f8f.33.2026.07.23.00.01.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2026 00:01:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784790106; x=1785394906; 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:content-type; bh=njXFzolhxF9m8wpOePYV3zpTWlWb14dNREPPOWvkdSc=; b=BpXX51Tx+bluDBUbmRtFq5NM1VLCj8k3bC3GnRyHNvPiQbrG+CBDWsEh1rTnFcPH7q IyD91dcVeP36HZodjQxKSYcou0PK0wIz9PTF64P98+rpEwIVI83MSsX/pzth3YrQaFT1 NfSsgVzcw9CKysH2q4zHy55naBRZorDOmBHW8xWBp1O1BwD6iYAl3n0hHf4DB+dYmsdL OBP01BIJiClp6OQsf1AlyR0KIZI3Qg3Kz6RdKO7BcKwbe7GeWzKqRNIBZGyf+8KDQMuc EeHATBGZD4BlzFH/VuP2f33BU8pQ2HTIqbXrTreYAjgOeNvs5qvTMRZ7x4LVSS7hbxGC jGCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784790106; x=1785394906; 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:content-type; bh=njXFzolhxF9m8wpOePYV3zpTWlWb14dNREPPOWvkdSc=; b=m9XDzYA1aziBYqYRSYZZVeXOld99j0FaxnLIpzrgTv0PVso+Qh0mWTCi6VKmLCWhF1 rR5TfQCLV68XMSIKbQroPdhqU2WChMPCtDtBM2AyqUHDyiDwsQAQsWsoFEdzMQYWYteE LSUhMgn3YG61nzbZfKmTmZQYcvXfSnehfgt576lRaN3Tu4uZtkwOU/Ai/kkQTOHKstht TPMz5v56vM3kLv+ScwcYoj5v4nyJIJBbtThqiw1F0csPFIcsYXqgXwzNP8R9ETYGOw0A 5S5Vg68FzTfXspXsXQ0UEPby6m3H2SUP/xyukjaO+NP0i0wv9YQBi7di4d/+5tGicdID bKvw== X-Gm-Message-State: AOJu0YxuxTq7OXkzqoxwQqW4A8NQrfE3ICgpWrFUotDPjZePT0Eo4M72 5b7D6wXLbjUXv4SkUsp85FA5p+yoIrl+ou82ayJb4/zYruuf+s9HTt38s4GUvg== X-Gm-Gg: AR+sD13YvvOsSZsJqtt5j0uq4BP3TMiAYbrvTRlJzncHJeELnWr8mkpx+JafPCTBKbY vRHYtKhPFNz3RJYKEeJuzijIo+VnA5Cg6B8ekjho84xFQizTE5/IzfyBa8D7usKqAawOtVagFxh dITqdO0ltKKLekTs95KvzvpAcpJHd3EiZXJwP8g/L3e0wk9Xfwro+cuFfVS6NDQYzXg9JDHO6VO 4XxNJfkeDoym7lsTPn6PbqdOuJy2SV5QOyhFg0Clm/3quS2dPIkfgzlj2BLwBY+nbUbmnfUMbUE X3FScOvFNe+POhWa/bp0D/TysRlDE4AtsdvGxFpBu86rMOh4/SI4WoE6VRKDJ8Q3nfTAJNPTROT 5Qgvm1e0fVHRYyx61wOzxOGdBH9oCY1+BX7tP1tKZ4z76wd0NXfL7lpKUSUhCGs5/iM/NbA2TTu HW4qYis1I1ZH0SznhZ4tp7uNZyV19Vyt5Pu5C4u0lrPesSUCkP6UbwhUr3lGGDX7oE0NB4gBzRb ZEUylgfHxdMsJ/62Fko5G5ZWg== X-Received: by 2002:a05:600c:1f8f:b0:493:e365:ace9 with SMTP id 5b1f17b1804b1-49573c9af36mr15807695e9.11.1784790105841; Thu, 23 Jul 2026 00:01:45 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Pavel Pisa , Matyas Bobek , Francisco Iglesias , Jason Wang , Vikram Garhwal , Bernhard Beschow , Peter Maydell Subject: [PATCH 3/9] hw/net/can/flexcan: Fix out-of-bounds access in flexcan_mx_rx() Date: Thu, 23 Jul 2026 09:00:53 +0200 Message-ID: <20260723070059.6332-4-shentey@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723070059.6332-1-shentey@gmail.com> References: <20260723070059.6332-1-shentey@gmail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=shentey@gmail.com; helo=mail-wm1-x32f.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, FREEMAIL_FROM=0.001, 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 @gmail.com) X-ZM-MESSAGEID: 1784790175601158500 Content-Type: text/plain; charset="utf-8" Require `last_not_free_to_receive_mbid >=3D 0` before indexing `mbs[]`. This prevents a possible `-1` array index and fixes Coverity CID 1662790. Reported-by: Peter Maydell Signed-off-by: Bernhard Beschow Reviewed-by: Peter Maydell Tested-by: Pavel Pisa --- hw/net/can/flexcan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/can/flexcan.c b/hw/net/can/flexcan.c index 3a97edf7a4..dd92a38337 100644 --- a/hw/net/can/flexcan.c +++ b/hw/net/can/flexcan.c @@ -1075,7 +1075,7 @@ static enum FlexcanRx flexcan_mb_rx(FlexcanState *s, = const qemu_can_frame *buf) } } =20 - if (last_not_free_to_receive_mbid >=3D -1) { + if (last_not_free_to_receive_mbid >=3D 0) { if (last_not_free_to_receive_locked) { /* * copy to temporary mailbox (SMB) --=20 2.55.0 From nobody Sat Jul 25 07:03:16 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1784790202; cv=none; d=zohomail.com; s=zohoarc; b=Jju5KukmoQffQIpbTCaGaFWP1gzNEnlLqbnxZp+NV0bIdn3n7WskIV1BRSAPBy9z8OhyQ+BVUTgEHGsykpfy/FhGyOTdTwceTAb2JMs9HI4I5qdqvLVHY2PvRKUffDULx7H+FVQxX/byg2cHBJ+JiLDhHYl+AeV8jMCyB1g6l18= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784790202; 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=EM3hMp/KfUSEwl/8SCDaWLH0SWyyv+tEDVdwL/ZkQ2c=; b=RAOoxC5RREx18ooERMZ0N6Ixq/66u8JKjcWbDz2XI6TRtZIXfrlQwX0DW3m7v9XmDvXQzsLSOlQWIgXIWSYBl80ZcPY2SA0EcynpUxBaXfvFcPgPVgxU6E2RdUwZjYUf05VCoSgTaM6/hczK3N2UYVtcvidkGv0LiLmaTN2dgJg= 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 1784790202733809.778597012843; Thu, 23 Jul 2026 00:03:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wmnRR-00020e-JQ; Thu, 23 Jul 2026 03:02:01 -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 1wmnRG-0001xO-69 for qemu-devel@nongnu.org; Thu, 23 Jul 2026 03:01:57 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wmnRE-00042p-FX for qemu-devel@nongnu.org; Thu, 23 Jul 2026 03:01:49 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-493f75f7172so2552395e9.1 for ; Thu, 23 Jul 2026 00:01:47 -0700 (PDT) Received: from Provence.localdomain (dynamic-2a02-3100-29ed-6000-0219-99ff-feb2-2458.310.pool.telefonica.de. [2a02:3100:29ed:6000:219:99ff:feb2:2458]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f85c6dc25sm13293923f8f.33.2026.07.23.00.01.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2026 00:01:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784790107; x=1785394907; 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:content-type; bh=EM3hMp/KfUSEwl/8SCDaWLH0SWyyv+tEDVdwL/ZkQ2c=; b=rO1fh2OT1ZCvZtzYfhBd8VonM4p8dcxN8ne/zxdvwFj/XT/cFctDXfvNk3GOZ/VDkq 5yTAdoOB/GV0bNlOJez2Naja8T7UXM/t97vltPou3dDUtWS/lxXWoxbRUPq94IF5AY+g 3cygZsHl5ixbEbfTSEM5NSKUpGWIS1jSOR0ZRBTQu+3T+0pnHHN3akDJ2g5RYVqFsA3m o1rKXL7kGF69jcX94lsUKOiRjKZ90X1Wn/6s5MybXv3VnEonr2eFxTqfbi+tFUm0grrK rCuWavfDoQEQYYAXeehpQa/7TJxMIyEZexaB7QRiLPm+1oIGK2aD0FA0U9rTo/lGzX7a Ir7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784790107; x=1785394907; 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:content-type; bh=EM3hMp/KfUSEwl/8SCDaWLH0SWyyv+tEDVdwL/ZkQ2c=; b=UCl+ZRC7PH7KmT8fatHhVgvg12JWpV5a3oI91rvGSX9YdJhsSObjvuM6+d2+AZUGOo 5S37u4tWHO/+AnInZLEzv/Nqhi6L5i4Pa5NsHKgpmtfojJKBUdmpAupsNejBqOzim7B2 QFNUf7RAF4wQCA+6Wb/ltFSn0t79D4pd442GxuWS6YqOzK7U/ENU5t2qruTSHdTg0iUS V5mq9qbTYDWXXHdD5sKVdqr1IYFOMkWrDrgj4kaXanqPxwZrCELO7L4GpFq2SkeZdWmh FTDSZwUVXZhv+CDvI6IfE7pSa4ND9FxpcJmAhvASih6DfO05nhXEQ9SKPKYAo+kCfcgK /HyA== X-Gm-Message-State: AOJu0Yyrd+BrvMuvvS+UIRGv6OhWb3vvAMmNgkuZTGcB5mumLsgzGbyd CEhHw6pvUE2c6xPY/ksR8wOwQYG31xqSexZMhd+wVbvflMm060rt9StwsmW3DQ== X-Gm-Gg: AR+sD13x1IIwPt0H94azf3Wm9voOdMzp6Y0tLAV2nZSW0qqeY9EEYLsXnU9N2zj8m0+ BMnYnDwZ34WsFrnG5giDjdRjhHBu9UW0C6cRZxOwChoRtCFuUOieQsseMY0xAHZ9OCLUrV/FNnz z5Im2r3E7m98/BCeRpIZk5Zxjz2cptxyybJ+viwlqfKuXfz8AoE4A60aGimUKnt9Zrv7V31XgYr TatMZtDTMb9Ir13+bKrr2ti3BQ6KRkduTVaccqFoLouUhLit0eJNp5Hwkxd7MCMFMFJO37mDneV EaA5ZI1/g2BcqcOAZPwq3q9LBPtk+pymrWiUFC9IOI30lpg4jjcd9Aa9aVi5X6nLn7xMPkyzCvN LQxFq/50F/4nN5iZz4uUoyMGsiovqNzaojJsczuW/PsoP6RuK38GALmSZ9Tv1aAf77oVLOePk/4 I/zpN6WO63rpisxXfYXx1so7g5Z0t2ma+6LdynuECH7zJNenA1w05COHhfLcUNaf51v58ITipKf Rl+LDxpg8favXgo6OKqPS3kNg== X-Received: by 2002:a05:600c:6610:b0:495:6a2a:951f with SMTP id 5b1f17b1804b1-49573cd02fdmr19339135e9.17.1784790106711; Thu, 23 Jul 2026 00:01:46 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Pavel Pisa , Matyas Bobek , Francisco Iglesias , Jason Wang , Vikram Garhwal , Bernhard Beschow , Peter Maydell Subject: [PATCH 4/9] hw/net/can/flexcan: Fix mailbox index calculation in flexcan_mem_write() Date: Thu, 23 Jul 2026 09:00:54 +0200 Message-ID: <20260723070059.6332-5-shentey@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723070059.6332-1-shentey@gmail.com> References: <20260723070059.6332-1-shentey@gmail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=shentey@gmail.com; helo=mail-wm1-x32d.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, FREEMAIL_FROM=0.001, 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 @gmail.com) X-ZM-MESSAGEID: 1784790204257158500 Content-Type: text/plain; charset="utf-8" Calculate mailbox indices from the `mbs[]` array layout instead of the oversized raw `mb[]` view. This prevents accessing mailbox entries beyond the valid array range and fixes Coverity CID 1662974. Reported-by: Peter Maydell Signed-off-by: Bernhard Beschow Reviewed-by: Peter Maydell Tested-by: Pavel Pisa --- hw/net/can/flexcan.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/net/can/flexcan.c b/hw/net/can/flexcan.c index dd92a38337..651904fa37 100644 --- a/hw/net/can/flexcan.c +++ b/hw/net/can/flexcan.c @@ -1151,6 +1151,8 @@ static void flexcan_mem_write(void *opaque, hwaddr ad= dr, uint64_t val, unsigned size) { FlexcanState *s =3D opaque; + const int mbid =3D (addr - offsetof(FlexcanRegs, mbs)) / + sizeof(s->regs.mbs[0]); uint32_t write_mask =3D ((const uint32_t *) &flexcan_regs_write_mask)[addr / 4]; uint32_t old_value =3D s->regs_raw[addr / 4]; @@ -1208,11 +1210,8 @@ static void flexcan_mem_write(void *opaque, hwaddr a= ddr, uint64_t val, default: s->regs_raw[addr / 4] =3D (val & write_mask) | (old_value & ~write= _mask); =20 - if (addr >=3D offsetof(FlexcanRegs, mb) && - addr < offsetof(FlexcanRegs, _reserved4)) { + if (0 <=3D mbid && mbid < ARRAY_SIZE(s->regs.mbs)) { /* access to mailbox */ - int mbid =3D (addr - offsetof(FlexcanRegs, mb)) / - sizeof(FlexcanRegsMessageBuffer); =20 if (s->locked_mbidx =3D=3D mbid) { flexcan_mb_unlock(s); --=20 2.55.0 From nobody Sat Jul 25 07:03:16 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1784790172; cv=none; d=zohomail.com; s=zohoarc; b=idYwZO4MdYBNTttzzDS1YyWMnAYBC2a2YRMpiTgLa97QUWj0zp5L+U8qTu9djY6oEVBtkXA8nkqDbhWKLoXUoIgxiCPWuyBHx9QflJdA7Pxbwjhchz8L5ND9oymF5W/sB9f0laoTXTHpAZrrxtn2CTPzc0GcaW7Yq6As9ykedxw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784790172; 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=gJcyrLyvAkPJGCOFIwqQ1qZlG599jZ6Ylb6PlbHkOhE=; b=Tz46dYJq56UURb4mWXJrJlYU/FsneEOMn200+qXWmWT+usKZQ8BPSgzu+Vckx1rDhqvOfQhElXt/8NmZQJymAFmIWDqbr3OoeXVD1nYHOdVA+Lk1habUczPl/FQAX3Xp09pdA3JvMmhhJ/Q3Vfqt6Qdd9f3VA2jgW3t/ewHOUYY= 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 1784790172895890.6613797042028; Thu, 23 Jul 2026 00:02:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wmnRR-000203-4Y; Thu, 23 Jul 2026 03:02:01 -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 1wmnRJ-0001xW-Ny for qemu-devel@nongnu.org; Thu, 23 Jul 2026 03:01:57 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wmnRF-000439-SN for qemu-devel@nongnu.org; Thu, 23 Jul 2026 03:01:51 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-47f365afc5aso140451f8f.0 for ; Thu, 23 Jul 2026 00:01:49 -0700 (PDT) Received: from Provence.localdomain (dynamic-2a02-3100-29ed-6000-0219-99ff-feb2-2458.310.pool.telefonica.de. [2a02:3100:29ed:6000:219:99ff:feb2:2458]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f85c6dc25sm13293923f8f.33.2026.07.23.00.01.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2026 00:01:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784790108; x=1785394908; 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:content-type; bh=gJcyrLyvAkPJGCOFIwqQ1qZlG599jZ6Ylb6PlbHkOhE=; b=Qs2dWgtdA8RifsUfQngEq2M8SMWPANSnnxeE97+JfiW9gCvqtn738hT+1JTLNnhW+t yRNQ8FfIvKagiH9O0IBTyrbQdNYkvkJo0z2H/7AX/WE8q0L7pTX0hqdjlE5V3xa9pRRO mifmLajaqiR8LwPURBwIJ7pS89XuyaIGlbyPbRxVpu8JrYnviLJq46i5OfsMdgDLnd9Z qdDmbQMGnLfBawLmacqCerCJL+GhA1p20LmbisVplFMfnPEs+Vs0WUEwrRpIjYvX/jfz WWa8VtIn+55q/dpWZA0kAgUZtJX0Lkoq5z0C0VBksmF8zlSThrrMb/2U103ESvGHGBuK tKEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784790108; x=1785394908; 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:content-type; bh=gJcyrLyvAkPJGCOFIwqQ1qZlG599jZ6Ylb6PlbHkOhE=; b=LwIq4q/HrryNqKc3DnIdwXsHFKnJl4gJcQaRWD0P+xstsWc9ltCat6DS/I4qYK5puJ 2m+iJGkOSUVJCxC5laoK/hEFo6J3dHhvlv7l9GbjBYgEgWLZ1hLIK/KTA4+7lFREq1Xh +wIi9HYHh5qh/+6km3+hLN+Ao2QJ4TtUMIevc+X+k2Zls5dmXz7eFHOkgCrNMti08FXc hp3LODMiBGhEhWIJLKCkebiC1wZTG5wcj0sPe4ZN7mPJaYcRtkengnO+0JRjCcDi7fv6 G7cg4MTqeT9YBGCswKN1kqJZQGTA/1ANmLRxkG/ojH28d6FOtwTBbcQh7Cpdzm3Sm28g U6FQ== X-Gm-Message-State: AOJu0YwLf0/b5z+PZ2p5BknBZSqAlGWHleXu9RNS0NlhXyl04jVYam+E LDFLT4wgfcEPpZrAK19MAypotdQG8X27wVDFbZsFUYBDqnZjuGWwbRjUft2e8A== X-Gm-Gg: AR+sD10cdbwcixsgoG/UQCPqAybmi2Er8iUH6eU1EecLNSHtW+/L1Jzjwn2+D0Kt3ER UBk8C+MzRV0xtSpisQ50OpD34fEpUWzMeS1/l4iURhU38etb3hc/CSoGhhsaZ8GMJ3PXTF3XBUs M+F+5NlEHYIuq+awbMXHkiWJz+6RuzwTvOjbIjA9EmfxxE0msyYgTy2LpC9oX2s6Lyf53yOBdrl Bft3dyrupONQ6gh0hvYaYuEQn/V2YnZN6QCxmEdIjU1L0+d2KX0+QSMwFf0iGBsS5UcTfZMr5C4 YmIxFvRr6KvYbr/BEBkfO3/IozCn+1cE6hJ0BlgLGaIWKfwiSxvQDk6vF/UXmJUweL+cqXEttlU ntv+Lqpm99dd1QjBRGMkaMe7+6ykD88S+B2zlbCij69KjD+uX99AsfoJEcCHWRJnsoPjproqFJ6 KHf1GcsIyHD1NCW/DXDDqy6MY9+Wm2/S7ymd/x+07W4Zt+v3uqIZUlGYiZx7MrhTG70xdHYpCsn ZIdvGHToieP7EVfcrLOe69hxg== X-Received: by 2002:a5d:6f08:0:b0:478:1a24:912d with SMTP id ffacd0b85a97d-47f8dca552cmr2476700f8f.57.1784790107868; Thu, 23 Jul 2026 00:01:47 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Pavel Pisa , Matyas Bobek , Francisco Iglesias , Jason Wang , Vikram Garhwal , Bernhard Beschow , Peter Maydell Subject: [PATCH 5/9] hw/net/can/flexcan: Fix mailbox index calculation in flexcan_mem_read() Date: Thu, 23 Jul 2026 09:00:55 +0200 Message-ID: <20260723070059.6332-6-shentey@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723070059.6332-1-shentey@gmail.com> References: <20260723070059.6332-1-shentey@gmail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=shentey@gmail.com; helo=mail-wr1-x430.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, FORGED_GMAIL_RCVD=1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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 @gmail.com) X-ZM-MESSAGEID: 1784790174620158500 Content-Type: text/plain; charset="utf-8" Calculate mailbox indices from the `mbs[]` array layout instead of the oversized raw `mb[]` view. This prevents accessing mailbox entries beyond the valid array range and fixes Coverity CID 1662974. Reported-by: Peter Maydell Signed-off-by: Bernhard Beschow Reviewed-by: Peter Maydell Tested-by: Pavel Pisa --- hw/net/can/flexcan.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/net/can/flexcan.c b/hw/net/can/flexcan.c index 651904fa37..8d680f1832 100644 --- a/hw/net/can/flexcan.c +++ b/hw/net/can/flexcan.c @@ -1239,14 +1239,12 @@ static void flexcan_mem_write(void *opaque, hwaddr = addr, uint64_t val, static uint64_t flexcan_mem_read(void *opqaue, hwaddr addr, unsigned size) { FlexcanState *s =3D opqaue; + const int mbid =3D (addr - offsetof(FlexcanRegs, mbs)) / + sizeof(s->regs.mbs[0]); uint32_t rv =3D s->regs_raw[addr >> 2]; =20 - if (addr >=3D offsetof(FlexcanRegs, mb) && - addr < offsetof(FlexcanRegs, _reserved4)) { + if (0 <=3D mbid && mbid < ARRAY_SIZE(s->regs.mbs)) { /* reading from mailbox */ - hwaddr offset =3D addr - offsetof(FlexcanRegs, mb); - int mbid =3D offset / sizeof(FlexcanRegsMessageBuffer); - if (addr % 16 =3D=3D 0 && s->locked_mbidx !=3D mbid) { /* reading control word locks the mailbox */ flexcan_mb_unlock(s); --=20 2.55.0 From nobody Sat Jul 25 07:03:16 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1784790181; cv=none; d=zohomail.com; s=zohoarc; b=aPdcQsyhjduiB1taBxQYmYeT9/tOy3eMT1lAC4k3X9GSJxY+whdwnXCGf9PQ4sPLBh1muuBdVUf6XdDiVxD2BcDNa/+SJwlVEqsIYXisdo1Ii2NQigT7CRZ6k/3kAeBjYRFMZT2XUmSVgQ4aKxPCHdcJke30bD5+jqv2EHkNfO0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784790181; 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=WZjtpQtNSxI6AiGZFSXK11dMHv4Q6M+80pXz7HWALe0=; b=SX1wE/HeTuVqCMhgCyfHCaeX0gDjXZz8PgD0DYNKZow5pz63E+gHiVFLlpFkXauQYa5xxjblGcvidHoTNIaouvW6fElGxXWn35CdFB0JUCyCV5mrK8+r0rPKNzsmEH2y9DfJBE4W5n9A8xPbUY+T7a5mtwMYhhv19natoBPAmos= 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 1784790181232999.0099915133355; Thu, 23 Jul 2026 00:03:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wmnRW-00024x-5c; Thu, 23 Jul 2026 03:02:06 -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 1wmnRJ-0001xX-ON for qemu-devel@nongnu.org; Thu, 23 Jul 2026 03:01:57 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wmnRG-00043Q-RE for qemu-devel@nongnu.org; Thu, 23 Jul 2026 03:01:52 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-47f633e6058so213356f8f.0 for ; Thu, 23 Jul 2026 00:01:50 -0700 (PDT) Received: from Provence.localdomain (dynamic-2a02-3100-29ed-6000-0219-99ff-feb2-2458.310.pool.telefonica.de. [2a02:3100:29ed:6000:219:99ff:feb2:2458]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f85c6dc25sm13293923f8f.33.2026.07.23.00.01.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2026 00:01:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784790109; x=1785394909; 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:content-type; bh=WZjtpQtNSxI6AiGZFSXK11dMHv4Q6M+80pXz7HWALe0=; b=foXCs6cwsvFEae++j4ZYlOwpsOsdodec+pbAYn+DoSw3UgvCBHLu+ICAnnBJ1CNXDk Kre4YQMvr4nl2JqBhRGjvqsLZcsvnFdYDdx1wicSNEJsHN/GU7tPIo1pXZfI2X0kjXbg 3+POApag7nOOkVa+xVUM2e+aolbnWM8sGPD5hvXY5dSrNgWhf6pypkz3Vgoy4F+WvwrC MgIOB2CI5z91Jl6y0AVV06aTdaSVinC9j1/cR4IHSsB7mUx3JmENrHocReQu/UsCo2VT 2oZ1kQTxopJHr/L4GV0y9iHCBn/eMA9vVbtGT1o2cYepQFP1b0WQhD+iM/+GMFpp+hv2 wNGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784790109; x=1785394909; 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:content-type; bh=WZjtpQtNSxI6AiGZFSXK11dMHv4Q6M+80pXz7HWALe0=; b=XW/0U1fBxvSI/boZPOJwx9BSjuAzyOGBURrNdyosmGY+G474E9cmiB2KAoahWFV5nA 0Dv5lZqFX/StKc1V8ksb9re71eY/Wa5tmWoRXXxH9YD/fMXhxNi3GyunUqvUWQTkvG/n ZZ0zEN5X4Bpsq3GcYOcKawdDVHfCkUh/UgswpZtJVZqrYc5Ryj1mJvfr5MD6peqinJZO 9hQeGFK+mlA9APiq4yeF9Cl3FNS0xm3r+0FyBZgmHwthA5ZgZbgdtLbKtpfabmKVX/MR e4zd7Ig2b+IhG2BdEzoT6MCykbgnHqxUJguMys1d6dSgOFISDebkZNVc3rgHg/xk4+hk MRdA== X-Gm-Message-State: AOJu0YwSQ6l547JC7FZ4dle+pEaIwMACga1e1wQNZ3jIcIWEPc3N95C3 zBMIhBWX6LymsjJPfz0v9dmLIh6ukRQaHTEi8B9YmpUyGNz2jn5gQht7M+Ip/q6s X-Gm-Gg: AR+sD11uHXRZ5f3Q/0tTeS2SH/p/E+vgLmy3VTou08+qV4drUZFUs7RQO5T/m6n2Nxl aHkMpz/xcUxrk0e/E2PJvr6mFUnDITtqWF1DF7LkT083p7BkBEtmYpWRLKM85BUcOBsr2ob1TqI Pi37jiL0Xy5X4lqaYcdM+lHRdBiLSTcKIv+MHGn8jCA5EgZWrqapm3GRYHjFk//mP2OESsT38Cp Kds3eEYgoxQXW+aR13LkWRhj09szdXXrCix9+JuZ96HoPjG0VuRon9DmIc4KuJH+d9xUq4wIDkg pLAZ2Asi290KZhGKJWvTyFCicjXXjUC269jm0Gx2+vaM9EKtY5fHuLagQaci/oUjsnVR/4vqD4q e/ATyO2k+CUIegZSlOkdawUZ1Zny6RSsfPv6EcGIt6WFwKtiZQ8y3JvAjLdbs6DeF0SpCZpPatd x/rOJ+4pHG0f8Fa4lJ6Wq8I2bY1P5e/DL+dJrU7vLOQ9T6cj+vVE4hyq6Fx0npjTJ/D9FLRpvDt 1LfwVI7d84MkHc/8gh0z95quJznso6jaPiU X-Received: by 2002:a5d:5d0f:0:b0:47e:81aa:3822 with SMTP id ffacd0b85a97d-47f8d760694mr2025128f8f.42.1784790108950; Thu, 23 Jul 2026 00:01:48 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Pavel Pisa , Matyas Bobek , Francisco Iglesias , Jason Wang , Vikram Garhwal , Bernhard Beschow Subject: [PATCH 6/9] hw/net/can/flexcan: Fix mailbox reset mask initialization Date: Thu, 23 Jul 2026 09:00:56 +0200 Message-ID: <20260723070059.6332-7-shentey@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723070059.6332-1-shentey@gmail.com> References: <20260723070059.6332-1-shentey@gmail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=shentey@gmail.com; helo=mail-wr1-x42e.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, FORGED_GMAIL_RCVD=1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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 @gmail.com) X-ZM-MESSAGEID: 1784790182144158500 Content-Type: text/plain; charset="utf-8" The mailbox reset mask initialized only the first word of the raw `mb[]` array. Fix the initialization to cover the whole mailbox, as indicated in the field description in the header. While at it, use the `mbs[]` view instead in order to drop the redundant and oversized `mb[]` view in the next commit. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Pavel Pisa --- hw/net/can/flexcan.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/net/can/flexcan.c b/hw/net/can/flexcan.c index 8d680f1832..f84f090a7f 100644 --- a/hw/net/can/flexcan.c +++ b/hw/net/can/flexcan.c @@ -134,7 +134,11 @@ static const FlexcanRegs flexcan_regs_reset_mask =3D { ._reserved2 =3D 0, .dbg1 =3D 0, .dbg2 =3D 0, - .mb =3D {0xFFFFFFFF}, + .mbs =3D { [0 ... FLEXCAN_MAILBOX_COUNT - 1] =3D { + .can_ctrl =3D 0xFFFFFFFF, + .can_id =3D 0xFFFFFFFF, + .data =3D { 0xFFFFFFFF, 0xFFFFFFFF }, + } }, ._reserved4 =3D {0}, .rximr =3D {0xFFFFFFFF}, ._reserved5 =3D {0}, --=20 2.55.0 From nobody Sat Jul 25 07:03:16 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1784790188; cv=none; d=zohomail.com; s=zohoarc; b=cTLRfMGo9mnZ7+gXiVhqGwXzFLI3rA9wDWRK1L3SAfklMmRhHwlgjhTqogwqCb7uLcVAEBN1wgipp9rL1z2xVhcw4fgzCcfxMu6zyvWAqhi9y4Z7vwFPrIYGQW88tlLL2iAEODrtrQ08gUAVUwHIMfbzlmFJWkpmbCn69AYsjEY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784790188; 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=ZQzdmXPKS/GCfPOIlcxRtVIw5smE1l62zCnawYTu9wM=; b=JhrLAjcj5/VH3fKl5mYIV26yfcvmB1q1osiThZwm4XFAJBKo3EhM68Wx+COKW4IO5wvBnqW0TBOO6vNHOzSj2mlqIVSEZ0DEBS/g6pC7U/jxAR5c33bYZgO5NL+b+80CVlrs8MYCRaUsIHZHum3YqIl1MI8Vrfq24JXo12kEznk= 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 1784790188489686.5118921966796; Thu, 23 Jul 2026 00:03:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wmnRV-00024s-Nh; Thu, 23 Jul 2026 03:02:05 -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 1wmnRL-0001xi-1O for qemu-devel@nongnu.org; Thu, 23 Jul 2026 03:01:57 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wmnRJ-00043h-Fv for qemu-devel@nongnu.org; Thu, 23 Jul 2026 03:01:54 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4954df200ddso1803285e9.0 for ; Thu, 23 Jul 2026 00:01:51 -0700 (PDT) Received: from Provence.localdomain (dynamic-2a02-3100-29ed-6000-0219-99ff-feb2-2458.310.pool.telefonica.de. [2a02:3100:29ed:6000:219:99ff:feb2:2458]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f85c6dc25sm13293923f8f.33.2026.07.23.00.01.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2026 00:01:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784790110; x=1785394910; 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:content-type; bh=ZQzdmXPKS/GCfPOIlcxRtVIw5smE1l62zCnawYTu9wM=; b=fPx8JMC1Q5rWnof/5IQIAx/b94ljAJQNZ7sjZe4V5gecz7B5eCJhf4i4dxcNHHNs6C JqobpU3h0dUMUKRgeo5aWOZ+3kiEa4PLpaBx0kygSzSvkp92/oYYLtsgbfi3UNvn+645 1JzCrFIJxZrhytz/WRNVv7VGOc4aMHvkJskd4eU6TbyudOHCLMzOFci2CjfAmwKpGyOE NNt036QbD4pwEBVnVtYnN0p6KcLnYUjzzkbd7RbOKHD2xCwLW3jBP7yzv/OqX0W7JQIW xr8qihmBNUIKNmgesmj6waChbTXXrCU2J90X/XqxlW5znzNlaxiIfOBTN4yvt/Pcf9oI Zarg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784790110; x=1785394910; 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:content-type; bh=ZQzdmXPKS/GCfPOIlcxRtVIw5smE1l62zCnawYTu9wM=; b=h9YkUcJgM893u1uyv6Ua0gy37P1tUQ75xmWpAYOw6x/78UbOPt6yo1+qdBenv7E+II bOeJGDzqYuLRZQETV8QG1n14YxLnoMAIex6GdX2szbjaYE+crtwCYBqox010pwuNVHqI R4Gtvf09GGOqQnIBeBtmmykGFmFa3M8nCriFAGZKrQqlPZkJ6e88xJVGH7IikIZ1WtvI ewH9XhZVlDPfWB3cTp3Psqhv6PbMyMorSjd1HJoGPigD2JWapJQQk8i3ZqfrQZiHmUHS RzDwHsQ2WoWfSQU5+9SLnx5mL7SrD79Kt/1yoVzo2AY/VBLWxy8r6RaebmaYvtnavAkH +rZQ== X-Gm-Message-State: AOJu0YxXyqjwDAwsBP2Lb4725BXUsxcf3BX3Cvl3q1xiuMrXrfWAtkJx 4e/3tFKMDO6F9KdBUbFIQn5X+5ZWp26xbGvrouArQLh9GBIo3MmPRq0MINHeMCui X-Gm-Gg: AR+sD12tD3y22BZDZQl5FT2fPbq3G4arqDz8H8PF/0H2st824gwiIlPkUbrLCJj5QRG o1f/c2CiMOXSTkfmTOmQJhRPuDUma1tgL2QnfGaYgdGDLzfto2txdXjLNlsSxOC8JV8lzFpba1h 9talyGNMa/OWRGK2emU/Es8H36qrLWOgBvV5jPJxboR9+RTOUG+9RxsnK1zm59ZgcgIP7B2vf+0 N9K5oNe/L+luzSu7sWn6veimGEkhhHda4X2496pF5nGoyY2axTM8sNV7+t1BwCKG0BUomoPUCfY 4hDVs6etBErJmw0k5whAr6zMHLSVQPeIU3Q+2tyTv7CKS9J9MtN+2C9sR95U4kepl9D02rP9VkY X9fauRqBegfMZ7ZKxRlwa1RBzDkGt2IX+Ln27s4Qe7M9bS4yKSH1uwLov52bQtleFebOMNmswpv jg2cZa+Jy2hSGQ9fEocVDCmR3IsImhTiNWEhkk1dbHsoJZcx6aEV2pjzbbWk2iFmv+pLKH1SxZC F3tyFNAxivSnXUum78W+DNGypkrn1A5ltz9 X-Received: by 2002:a05:600c:4747:b0:495:737a:7afe with SMTP id 5b1f17b1804b1-49573cd3fa3mr23151215e9.15.1784790109832; Thu, 23 Jul 2026 00:01:49 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Pavel Pisa , Matyas Bobek , Francisco Iglesias , Jason Wang , Vikram Garhwal , Bernhard Beschow Subject: [PATCH 7/9] hw/net/flexcan: Drop oversized 'mb[]' mailbox view Date: Thu, 23 Jul 2026 09:00:57 +0200 Message-ID: <20260723070059.6332-8-shentey@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723070059.6332-1-shentey@gmail.com> References: <20260723070059.6332-1-shentey@gmail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=shentey@gmail.com; helo=mail-wm1-x32e.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, FREEMAIL_FROM=0.001, 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 @gmail.com) X-ZM-MESSAGEID: 1784790190322158500 Content-Type: text/plain; charset="utf-8" As indicated in the comments, the `mb[]` a.k.a. `mbs []` views should cover 0x400 (1024) bytes. However, the `mb[]` array covers four times the size since `sizeof(FlexcanRegsMessageBuffer)` returns the size in bytes instead of counting the number of uint32_t fields. This shifts the subsequent register offsets by 0xc00 which is not intended. Fix the size and thus the offsets by dropping the now unused `mb[]` view. Note that the different size changes the migration layout. Since the device model is new, no change in the version fields is needed. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Pavel Pisa --- include/hw/net/flexcan.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/hw/net/flexcan.h b/include/hw/net/flexcan.h index d8159475e0..9affdff837 100644 --- a/include/hw/net/flexcan.h +++ b/include/hw/net/flexcan.h @@ -65,10 +65,8 @@ typedef struct FlexcanRegs { uint32_t dbg1; /* 0x58, unused */ uint32_t dbg2; /* 0x5C, unused */ uint32_t _reserved3[8]; /* 0x60 */ - union { /* 0x80 - not affected by soft reset */ - uint32_t mb[sizeof(FlexcanRegsMessageBuffer) * FLEXCAN_MAILBOX_COU= NT]; - FlexcanRegsMessageBuffer mbs[FLEXCAN_MAILBOX_COUNT]; - }; + /* 0x80 - not affected by soft reset */ + FlexcanRegsMessageBuffer mbs[FLEXCAN_MAILBOX_COUNT]; uint32_t _reserved4[256]; /* 0x480 */ uint32_t rximr[64]; /* 0x880 - not affected by soft reset */ uint32_t _reserved5[24]; /* 0x980 */ --=20 2.55.0 From nobody Sat Jul 25 07:03:16 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1784790172; cv=none; d=zohomail.com; s=zohoarc; b=YOL2cFNEv7ydWy7Kz+CllK7g3EQIBPhHjWLHCcIItI2kaM4sid0Wxus60Zx7nU3crNmElYMmbuzZRGhhHCAZjH69Z0bSKrTofsZ5rIPdJv+PfcSjgMjAkF6s1KWPCVD+8GAQMlMtcuvFH80EWnihXvTWOMlx2fZvbTrQrVGK4OU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784790172; 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=rp3IQqFJt5p9nlS3zJ1MItzaTmiVTLGkLsSBcTTrc1g=; b=at+Rrfo/VZXHFvsJc4CZgEZtvJSq3aDKeuFzOqcgjbcLhhN4sfY8Vwuo/II26jtIYdOrkXt4Z5qqc/V+wWcIO6xNyX5S6O3Y+f9K6hCJIvU4Tjc9TtD/s1sXkwwnjK0qiw4DBDpjx6WoqNCv+5zKoyyuBgX3Gomh+P/z50MUdUI= 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 178479017289133.40635333353873; Thu, 23 Jul 2026 00:02:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wmnRS-00022c-VM; Thu, 23 Jul 2026 03:02:02 -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 1wmnRK-0001xh-V1 for qemu-devel@nongnu.org; Thu, 23 Jul 2026 03:01:57 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wmnRJ-00043q-Fv for qemu-devel@nongnu.org; Thu, 23 Jul 2026 03:01:54 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4954d29264cso1191235e9.2 for ; Thu, 23 Jul 2026 00:01:51 -0700 (PDT) Received: from Provence.localdomain (dynamic-2a02-3100-29ed-6000-0219-99ff-feb2-2458.310.pool.telefonica.de. [2a02:3100:29ed:6000:219:99ff:feb2:2458]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f85c6dc25sm13293923f8f.33.2026.07.23.00.01.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2026 00:01:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784790111; x=1785394911; 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:content-type; bh=rp3IQqFJt5p9nlS3zJ1MItzaTmiVTLGkLsSBcTTrc1g=; b=JBFbGj82ab9D4mzC2M5kYZQX/bM7OeojnUNbIezVxoQ4qfDq2QXyKyo08+Q4qruJ0I Muad1ZskwVXUZz0wSNO/WLqk/2QWskfDqR2G9BhR3uCC4yfqaE6yDUuuLHt4HKZJu0CB ItleYrJY0rvbXBWU5fTmQijeE+/FwY3DB62iYBDw8TvWsD1lGgTPcnSkUh2aiJJCiPaZ zm8HUgyiqZIIUW9Jb3SAFM7NZe508gYCdINY74v3K62jaH//Wr6XQXuwnUn7xHNPxDo9 y3dldhtH/OB/Z3njTnWpbBBVq4CmfxwBmYC2sfGGQkl9gQmVqU5lnY4yfJeadCsPGq11 jYJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784790111; x=1785394911; 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:content-type; bh=rp3IQqFJt5p9nlS3zJ1MItzaTmiVTLGkLsSBcTTrc1g=; b=i9P+DLCFOgqkoq8xPPmmwcV1XXFS4QA+kuRL0bAgyxuPBpW2gEzzX4k182ryUzHVvF yuJxEwgpTFpILlH+iNE4/XJiWfgZAFSIQjEzVFwMl+KlT9dskzG/z1AyCOqgVBIV9LWO Lb4bHHijSGSf3s7IK3xIlsgu/BZdP6nlYHm0CbJ0eOAFZ2hCvtnXH7vAdcZZHkPRjvIs mTL8efLMR/pHL+fgFuWJgaDZeWg+M283H71bmXyg3fDZSlrZykIEFO2Rh1eUGIZuiJln i1kfuG9Km/8hdCquiZ0SSboLy+jk6swCWFS2L15yb6w0pYDOWwv7gS8Pn1Jo/9dsJCfa B5CA== X-Gm-Message-State: AOJu0Yxi/LZQO+YGCvK+762zUuyLCN78fHcCPHuoCmBRwj6I8vP8hG9o VArvZ/RxkSQbwOjIu5NbYKv0XMCtYOZ2Y+pedy78fta3Yc8nq2EN2QCk4r9Cpj32 X-Gm-Gg: AR+sD12RJu+f1Nmepa1hpEjy1mzjspG2VuZ7deXqGGNVxW59yzVhEE4kkcXvrxwae9z +OzJZJwQqn201PAnYeAzFZegevrzqz1qkxNC6SmXPXCOfJOm9vyl4GrcLdxT0A3tdKDTIoqgL9Q Fko6fD0pltdLAkMEtXV1JYVJlVIPv8ucqM2yk2UZaWA6J0dZHNLnDClT0V+2l/7r7L+efHVFEUN BAR9qmlGgKYTe1Tq9IXBbxoO7hXFSWAoGzjOj0dvq6DI1ugqpj+lo7nA7EfW5RIwi+i9icC01ZS X8aKqR9wgJvF3EsAxxv3JnsXcOgBoXIhQQgSHwSTwOhs4ZhtON28alzIr1zKk5Cp5DhXOYOlOmc u+PA/b6aqwl6HoBxC/eMBcbR2Iz5GLnAATB2InScqE3hBTHNdF+YAxct/jpd8KEibNzbkyGVYeV Xj1VbW+dFcstSdalAWp+6F2H3oOtbdfyBZ2ju6a98FtqyiDO/hR+5stdMkYm9pL+BjYZK9d/+/K GgROysjkL77mE2NUjeGd4GhOw== X-Received: by 2002:a05:6000:1846:b0:47f:8cfd:d383 with SMTP id ffacd0b85a97d-47f8d76e513mr2241303f8f.52.1784790110729; Thu, 23 Jul 2026 00:01:50 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Pavel Pisa , Matyas Bobek , Francisco Iglesias , Jason Wang , Vikram Garhwal , Bernhard Beschow Subject: [PATCH 8/9] hw/net/can/flexcan: Fix RXIMR reset mask Date: Thu, 23 Jul 2026 09:00:58 +0200 Message-ID: <20260723070059.6332-9-shentey@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723070059.6332-1-shentey@gmail.com> References: <20260723070059.6332-1-shentey@gmail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=shentey@gmail.com; helo=mail-wm1-x32e.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, FREEMAIL_FROM=0.001, 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 @gmail.com) X-ZM-MESSAGEID: 1784790175634158500 Content-Type: text/plain; charset="utf-8" The RXIMR registers are not affected by soft reset, so their reset mask must preserve all entries. Set the mask for the entire array instead of only the first register. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Pavel Pisa --- hw/net/can/flexcan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/can/flexcan.c b/hw/net/can/flexcan.c index f84f090a7f..205d0d6413 100644 --- a/hw/net/can/flexcan.c +++ b/hw/net/can/flexcan.c @@ -140,7 +140,7 @@ static const FlexcanRegs flexcan_regs_reset_mask =3D { .data =3D { 0xFFFFFFFF, 0xFFFFFFFF }, } }, ._reserved4 =3D {0}, - .rximr =3D {0xFFFFFFFF}, + .rximr =3D { [0 ... 63] =3D 0xFFFFFFFF }, ._reserved5 =3D {0}, .gfwr_mx6 =3D 0, ._reserved6 =3D {0}, --=20 2.55.0 From nobody Sat Jul 25 07:03:16 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1784790181; cv=none; d=zohomail.com; s=zohoarc; b=YeATJeTlIQw6fNWXtxPk8EK1dAY9mLMWeim5nvl6iRnHZfQ6rUxQ16eXhTXLK+te+tkQppM7owjS4z3UcuvDBLytHYfly5/O3pjfCB3STDC9W6kgf2fLOHL/QooacQhxqPwaKkSEDNoo9capZhQkLadyrMvCm/l2cbKNc89nCNs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784790181; 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=gx+nP4/fruRtsOB2fGcEDD0bbwS2iaaOfg3Ia3056d8=; b=EBaCCh+nmC2hxVephPJFulkONFRfdqG5igs/g2csNuhkNbHIOf8xIF9Mo8SwpA1msheoI+bTjfGaGVMUPt/i+JJL0wNw9LkHI9uCQaxhkcu57OU2YclsAxxzBnwtoRJSqlHWvUnwmWXhywhFG9+C3i10VfwA8KN24exvXLfUxKA= 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 1784790181125109.06337774228416; Thu, 23 Jul 2026 00:03:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wmnRR-00020w-LY; Thu, 23 Jul 2026 03:02:01 -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 1wmnRM-0001xm-2J for qemu-devel@nongnu.org; Thu, 23 Jul 2026 03:01:57 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wmnRJ-00043x-Gx for qemu-devel@nongnu.org; Thu, 23 Jul 2026 03:01:55 -0400 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-47f703a9d05so122702f8f.0 for ; Thu, 23 Jul 2026 00:01:52 -0700 (PDT) Received: from Provence.localdomain (dynamic-2a02-3100-29ed-6000-0219-99ff-feb2-2458.310.pool.telefonica.de. [2a02:3100:29ed:6000:219:99ff:feb2:2458]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f85c6dc25sm13293923f8f.33.2026.07.23.00.01.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2026 00:01:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784790112; x=1785394912; 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:content-type; bh=gx+nP4/fruRtsOB2fGcEDD0bbwS2iaaOfg3Ia3056d8=; b=YkS9ZCxPF3LCwLdqn+Gbw2A6pH92DpLBBNJFh5kmDWjFvM0LjDSrRMQUkVtaYrk4sD M7q4gom7UwgqYqZ5cck6RuemmqLyoECa7dNFDTE/FrZL1nWWyzZqlNJ3CS299p1eAHws 6ucMPi0zfEzam/G+rzhxUcy4A+akBl7hhlOgnx9UJV+5K/9jlrS+wiDCiGI4NX8EYCbB IpzIVhks6XxAM17Bj1mNlgIPY9DfGWhW0iUz/f3Xa1pnoWAYm+IMk3imJMFLSy4Hw5XU VQAgCLMRWyCgl38ALavBQTG1cke+EdRRjzane54PPgypq2xrh0BTq5fYAmO79xNczJ+M m5Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784790112; x=1785394912; 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:content-type; bh=gx+nP4/fruRtsOB2fGcEDD0bbwS2iaaOfg3Ia3056d8=; b=pG6jyDRVGOJlAEpPSVyRIXlv7MH7c/or2/ons0v4EEN0Zu/48KP29FCxf8LiDYqV9t 5SKEkiJUDzt9rjro/lAZIW5avohuHqQCQOQoDSZqQmeUud2TIyGK6c4woIFaq9gql0ES H06G/7ieH0oAmTSJkie7dk7R6HTV7PHgq1bDHtTiQaGSbog/WJWlyv/p91KA7aHYuQ5W zAKAISXdrAcqozEWECUHilN/flsXY9v2a5hP0NGwf3nBhuDOzIkmVzG60hGSLan5a8fO eQBji6e19LpodiAG8DQlvXHbY+GYHqqSo8O9ol5FI80wbYXgXjKMdumCqC31U8B9qzhe auoQ== X-Gm-Message-State: AOJu0YzwamU/b9UQd9tlac5lOZQp4LN0At351qyyQV2m896AeDDX8OS5 DoVdCp+SpxwGxhonZB50DVozOly+fTnvHBBt1WrHvG9ia3NHer1VYno7PBSYUzWc X-Gm-Gg: AR+sD12lkBuZlChWTZD7gAwJXUSjtQR0kka/3qp3T7igbUNtZpZ6LcD5xmZPkBMKoHz MqHb1aEVwG2cYH8R+NxSpOdr9pSiU7Jg1Hct+CKeVV6p9aS9YWhbwd+4B5Hh3AGQiTYf534jr13 mVMV1dquCNFWxmaf4lJL6ij+ONhiUeo0Feswdd2AZBmQcnu1bFGgX2J1CArAy22+fSYDrR77oUy uJx7B5nZyEZndpnnWPxuPO2B3zC64kGBdPGTU23Xej2NPTIPsC262FGZ0AsARiHTj9YBxUY1btW u609IQdKW29StxiJVcdOI82Ovc050uzkljrZtG8GwBnzJJDNo/MGTILtNUmUe96Ew/sJnfIHO40 HrBffC75aIUmFm4ezVrbWZl9bw6Vb5FyVjzvn2wg5VLFis4IFvC1W50H2Fei83VmbhE/lX1kffA 7XQmeOf24ewZy0xlIhaC0PmquIt/VARAb0i4xU87pvgU0zJkmMs+3X4XIoeh0HEQ2+nSQ2yp/bm i5PBOYomkUo5LoiLKPemFcu7F6Onnhi5+Mi X-Received: by 2002:a05:6000:230a:b0:47f:8817:eb6f with SMTP id ffacd0b85a97d-47f8dcb377amr2111163f8f.49.1784790111571; Thu, 23 Jul 2026 00:01:51 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Pavel Pisa , Matyas Bobek , Francisco Iglesias , Jason Wang , Vikram Garhwal , Bernhard Beschow Subject: [PATCH 9/9] hw/net/can/flexcan: Remove RX SMB raw view Date: Thu, 23 Jul 2026 09:00:59 +0200 Message-ID: <20260723070059.6332-10-shentey@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260723070059.6332-1-shentey@gmail.com> References: <20260723070059.6332-1-shentey@gmail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=shentey@gmail.com; helo=mail-wr1-x429.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, FREEMAIL_FROM=0.001, 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 @gmail.com) X-ZM-MESSAGEID: 1784790182156158500 Content-Type: text/plain; charset="utf-8" Use the existing `rx_smb0` message buffer view for register masks instead of the raw register array. Since all accesses now use the structured view, remove the redundant `rx_smb0_raw` union member. Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Pavel Pisa --- include/hw/net/flexcan.h | 5 +---- hw/net/can/flexcan.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/hw/net/flexcan.h b/include/hw/net/flexcan.h index 9affdff837..eee70bad42 100644 --- a/include/hw/net/flexcan.h +++ b/include/hw/net/flexcan.h @@ -81,10 +81,7 @@ typedef struct FlexcanRegs { uint32_t _rx14mask; /* 0xAA8 */ uint32_t _rx15mask; /* 0xAAC */ uint32_t tx_smb[4]; /* 0xAB0 */ - union { /* 0xAC0, used for SMB emulation */ - uint32_t rx_smb0_raw[4]; - FlexcanRegsMessageBuffer rx_smb0; - }; + FlexcanRegsMessageBuffer rx_smb0; /* 0xAC0, used for SMB emulation */ uint32_t rx_smb1[4]; /* 0xAD0 */ uint32_t mecr; /* 0xAE0 */ uint32_t erriar; /* 0xAE4 */ diff --git a/hw/net/can/flexcan.c b/hw/net/can/flexcan.c index 205d0d6413..a8bad83cb8 100644 --- a/hw/net/can/flexcan.c +++ b/hw/net/can/flexcan.c @@ -106,7 +106,11 @@ static const FlexcanRegs flexcan_regs_write_mask =3D { .gfwr_mx6 =3D 0xFFFFFFFF, ._reserved6 =3D {0}, ._reserved8 =3D {0}, - .rx_smb0_raw =3D {0, 0, 0, 0}, + .rx_smb0 =3D { + .can_ctrl =3D 0, + .can_id =3D 0, + .data =3D { 0, 0 }, + }, .rx_smb1 =3D {0, 0, 0, 0}, }; static const FlexcanRegs flexcan_regs_reset_mask =3D { @@ -145,7 +149,11 @@ static const FlexcanRegs flexcan_regs_reset_mask =3D { .gfwr_mx6 =3D 0, ._reserved6 =3D {0}, ._reserved8 =3D {0}, - .rx_smb0_raw =3D {0, 0, 0, 0}, + .rx_smb0 =3D { + .can_ctrl =3D 0, + .can_id =3D 0, + .data =3D { 0, 0 }, + }, .rx_smb1 =3D {0, 0, 0, 0}, }; =20 --=20 2.55.0