From nobody Mon Nov 23 04:34:32 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=1792699217; cv=none; d=zohomail.com; s=zohoarc; b=eM1xAF1wz4Zc8t8p5q2jpzoSht2b7jb2rtj9ul/tRR/78GZixzwMHSS5FaAJ+mNJ7PGQJ2vzD0G8ycrASFIy+ObsgMcuIt6pj2oCzinRdg6oafBQyy8dCkuQv1lKKmg8ypGIUP5FqFo1sS/8eAWNH3wKvMO8o9fGloMP5VFYr/w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792699217; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=uwt/aBfIVnj6q/gSUcPnJ2a8PJs4AKOazHIuE9S2L/g=; b=LMFfcziJHk1h86SVZ8adj1IRKKaPrvb6agu23LVZfmNOuJgFZvKXSK5aL3HB6JWJu1OVBIt0DTpWk+BbzRvl2UIrzoiGitxxXEKLUav0HDEUMDJBZk7i4MkClw+FNpgwxiYBFaN/TG1hst9M404gJOoVXozYEc6O1HIthj6R98g= 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 1792699217374386.62885012613253; Thu, 22 Oct 2026 13:00:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xJywq-0001OV-5J; Thu, 22 Oct 2026 15:59:37 -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 1xJywk-0001O0-Ot for qemu-devel@nongnu.org; Thu, 22 Oct 2026 15:59:30 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xJywi-0004fN-NY for qemu-devel@nongnu.org; Thu, 22 Oct 2026 15:59:30 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4a1e3098ee2so2084985e9.3 for ; Thu, 22 Oct 2026 12:59:27 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a21235a61esm159185e9.2.2026.10.22.12.59.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Oct 2026 12:59:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1792699166; x=1793303966; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=uwt/aBfIVnj6q/gSUcPnJ2a8PJs4AKOazHIuE9S2L/g=; b=jzPc5EPeJkUBg4PLuhtWCDZ8C6vSp1dBAZxo1Mijgz7BUfNX2nUH6rGYORII/jky7t vtsE0HeNhdr1WrjsCVRvq3nzJFLHsmeMRx6EJ7iSgpYqwFc9d1MOgP2LAMlEhAZWLfK7 qWxvI0dmO93h8wpE15oivxw9xCuR89OhQ3FcUSjmniYqv72fbbEcSfhI3IIIEliD0mo/ Tm1/M1krp8MgYg4H1rfvKPzVx6FixEBDpPNdj3l1XqA2Oa+oJ1k4aq+zMVPI4txjSn9x 8YA/m3N1syRBwL18LnxEZa3pWEJ0+Oy+IB/uX9gBygM0WPsX8dcdO0Bq6izQ3zUr2MYo BwxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792699166; x=1793303966; h=content-transfer-encoding:mime-version: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=uwt/aBfIVnj6q/gSUcPnJ2a8PJs4AKOazHIuE9S2L/g=; b=yyEF535QMMmuZn/QuYoaHsc1IiSrLqG7Rh5oNQeKHnISjtupNUZsVmEAqHgEu/+1ZZ bRjgv1vujOzHEorL6qjK5O5Ynb7sUyoAkUPocmg+RBd8Cj1VWc+UXv5t+c7t+DYjlTAz TEpqV0rX0aLy6kpnLzpBruIDCWkwMNrhHRAYtarsyLaZ6YXmTCYxL9aKPswxTQqTF73f zbyhm/XXdWJeAwk8c6xYrwS1J8E/KvznfX669ruQbzWGgbcQvqsMjCiKTLg53ujxlsj9 lbGgHo3/FL40Ja+71JppC5Wj6F85VghGvPVpqy3ExALcib+LlGJPeHaVqUf1ar+z1W6I pmKw== X-Gm-Message-State: AFq9FYKbAF6lEajnwPgBH8UsqIA20KT7ovUiVJoO/1PauN+lZIvZgi8q XvCeMadQ4k8kfqLwYF7QlhEUc7YFVi3g9wvAdCUNNjAzda4k6Xz29Jz/dw+0KvMseA0EPXzNm/P oKGJPQ7k= X-Gm-Gg: AYBFou36EARFQ9ycrRsz0v7PD+3PO+ZGvp9k2KMIV3XeR9mylwLLUfTtW923IJxfanX ZjbpeA+p7H9PhCPFh5DILzV0CV55fuAjjBJntYBE7TlhTX614LKMmxgY4YnKL5FSoHFNBHSeUWL UarvMI3IdaQ2d/zaDQIEUC9dFKTMEEKWy6RbtXPihuADkkPhZCTm7VR4KX2O54sDbewh5qi42wG Zd1JpvM25+0lMNJupN51HCS6PN6guEngZWd7DTe4mIeUF28ctXuyeXGqPIcyYz2m0ZvvWWkkElr dUq+sn5kwhiaKt1xpdK2ghfWnhP7gvBD1evXIq8WuZUjebALtANp/OUWm7vKyLPZPS2/xRtzADM DncclAV3KxRRU/V9mQDBLgp0DVGAnT2K+v3vkFQSMtsAj9e2+cbNQCHrzvHEcZUiJZ6CFSOjbDn jG+nawM7dDNqI6JrfaIXh1rpnWjkqRY31ibPumcc4taTzCNONFXxQCtbYH6uLhtnP7loeBrnWcc CGDo7uYjxBgx9HXDu6L1sWGBXVwrcX2j+fRktT6AnsbtXFXwGPpVEO3hCDhG0+ZQtRqr9mjI7dB sgMVCeehIdieyb8fOTLKIA3Qz1wZFqPZTsmypBAFNO3umaMChw0KY4V+GkQh X-Received: by 2002:a05:600c:4e8a:b0:4a1:d675:b031 with SMTP id 5b1f17b1804b1-4a211eeea21mr1820405e9.6.1792699166496; Thu, 22 Oct 2026 12:59:26 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: Matyas Bobek , Pavel Pisa , Francisco Iglesias , Vikram Garhwal , Jason Wang Subject: [PATCH] hw/net/can/flexcan: Fix FLEXCAN_CRCR_MBCRC definition Date: Thu, 22 Oct 2026 20:59:24 +0100 Message-ID: <20261022195924.672606-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 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::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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: 1792699220331158500 Content-Type: text/plain; charset="utf-8" FLEXCAN_CRC_MBCRC is defined as (((x) & FLEXCAN_CRCR_MBCRC_MASK) << 16) but FLEXCAN_CRCRC_MBCRC_MASK is (like the other _MASK values in this header) defined to be an in-place mask FLEXCAN_GENMASK(22, 16) (a value with bits set from 16 to 22). The mask and shift operations are done in the wrong order, and so the result of the macro can only ever be zero. Fix the macro to shift first and mask second. Cc: qemu-stable@nongnu.org Fixes: 3c4e23cbb597 ("hw/net/can/flexcan: NXP FlexCAN core emulation") Resolves: Coverity CID 1662973 Signed-off-by: Peter Maydell Reviewed-by: Francisco Iglesias Reviewed-by: Matyas Bobek --- hw/net/can/flexcan_regs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/can/flexcan_regs.h b/hw/net/can/flexcan_regs.h index c18bc4736e5..7923bf836ff 100644 --- a/hw/net/can/flexcan_regs.h +++ b/hw/net/can/flexcan_regs.h @@ -150,7 +150,7 @@ =20 /* FLEXCAN CRC Register (CRCR) bits */ #define FLEXCAN_CRCR_MBCRC_MASK FLEXCAN_GENMASK(22, 16) -#define FLEXCAN_CRCR_MBCRC(x) (((x) & FLEXCAN_CRCR_MBCRC_MASK) <= < 16) +#define FLEXCAN_CRCR_MBCRC(x) (((x) << 16) & FLEXCAN_CRCR_MBCRC_= MASK) #define FLEXCAN_CRCR_TXCRC_MASK FLEXCAN_GENMASK(14, 0) #define FLEXCAN_CRCR_TXCRC(x) ((x) & FLEXCAN_CRCR_TXCRC_MASK) =20 --=20 2.43.0