From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796173658; b=Fxya0v4L0Us0V+ZLTZebyg+S3EDILDqNc9xVqo1cGjnOYwxqIq/ymb7eJW2t45Sl6lh0 jlrqMt5FlEuRqNGpBjnOLap2PbXyECqFgByYYDsmmWBvTWzkODr+kkY9nlUbPqradzqLh Gq8Salci4CCy8JMqc9+hDiU0RLwJoNxBv0G4Ien5RpKg0Z3jdR5jnBEEz0i15IP+2LKHG bXousWISAAqB9/HXyK/wajsCEP04wFc25Okn2vcB79NZrSD0NFUBXGSquroRRzV+S0K+h JG2TOhDB259sOKbfBwIJX87OuqBcda1pvCUcDrKg83JpVWYRQchHEyYgupsKQ4ucE0w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796173658; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=gpowrNLde4MGWYG5b/hHJHHZYS04IwxYM9gSwc17GFw=; b=NibleXBqYzrjJvawDx+xq603P/87FMMxGOSQptz2m4f41uOefZgxciO0UA0ICjJ7D8zz hxKPXPzQZJOC2ZukRpanpfE85O4P2BQVEdeoF4R85gdxzhPxNsLuMakiIPN31O2aUmTLR ZF2vflGFudeq/wAQdVjd/ZbP6OwEDNt1gKn5gW7vvctqX2iX02dkIv7TZVwtSIMIRY/78 7kVggHiTREW8txeKc1PkhlrR6ANNsWNWyVkOgqOv4wspNk874bE6Os2RmAJy5q6hVpn+4 Y7P1n2hMTAaxPllMBdpuhrbB+s5kCZ1K2VWH/mTP1KJNmlKfoO31OCItzXoTAcoPxoA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gI8xRQtk; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0584606A31A; Wed, 2 Dec 2026 01:07:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gI8xRQtk Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4EF61F000C1; Wed, 2 Dec 2026 01:07:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796173658; bh=gpowrNLde4MGWYG5b/hHJHHZYS04IwxYM9gSwc17GFw=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=gI8xRQtkcnyfZS0AW8clh4oQ+C+Qb2ZaYrS5ya71erXh2kzi0DhtVft/EXPaFfTbC Y6O5riM4NvQyJq3inBE3svlHLKBPBhxwVVSGYOH6nymys8qxUGwKq9iwwbP+2ig9eG esZiihwpFuRA4Jnd0lEIRVg3M/L+BPcGtG2CmGeR6y5ixqC+RyP2WBskALLzdcxTG5 Xf7b/ZInoh2Aoq6jpx/kJW46/a+nf/h7vocOQpQFxQw6CCo8xKIcW2uZ5Qq64GhJ4E 2STmcIRRLuqoiin9B0hH9F8Lr3MZm5x/XBciPeHfvxumdIGTPIfYoKNdsUwHKqnbZ4 BSCn8JyfqAtqA== Subject: Re: [PATCH can-next v2 1/4] can: bittiming: fix divide-by-zero in can_calc_bittiming() From: netdev-bot+sashiko@kernel.org To: mkl@pengutronix.de Cc: mailhol@kernel.org, socketcan@hartkopp.net, wg@grandegger.com, davem@davemloft.net, kernel@pengutronix.de, linux-can@vger.kernel.org, ssureshmsd7@gmail.com, 25031212351@stu.xidian.edu.cn, stable@vger.kernel.org, byu@xidian.edu.cn, wencheng@xidian.edu.cn, kuba@kernel.org Date: Wed, 02 Dec 2026 01:07:37 +0000 Message-ID: <179617365740.3142.9703576724478254959@kernel.org> In-Reply-To: <20261130-bittiming-fix-conversion-v2-1-36e8a0275923@pengutronix.de> References: <20261130-bittiming-fix-conversion-v2-1-36e8a0275923@pengutronix.de> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-can@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] The commit message misstates where priv->bitrate_max comes from. -- can: bittiming: fix divide-by-zero in can_calc_bittiming() This commit fixes a divide error in can_calc_bittiming(). The divide error happens when the 32 bit product tsegall * bt->bitrate wraps to zero for large userspace bitrates. The fix computes the product with mul_u32_u32() and divides with div64_u64(). > priv->bitrate_max cannot guard against this: it is populated from the > optional "max-bitrate" device tree property, so it is zero for most > drivers, and can_changelink() only consults it after can_get_bittiming() > has already returned. [Severity: Low] Is this description of where priv->bitrate_max comes from accurate? The "max-bitrate" device tree property is one source. Several drivers also take it from the generic PHY transceiver: drivers/net/can/flexcan/flexcan-core.c:flexcan_probe() { ... priv->can.bitrate_max = transceiver->attrs.max_link_rate; ... } at91_can.c, m_can_platform.c and rcar_canfd.c do the same. Some drivers also hard-code the value. etas_es58x sets 1 MBit/s for es581_4 and 8 MBit/s for es58x_fd. dummy_can, the driver used for the reproduction, sets: drivers/net/can/dummy_can.c:dummy_can_init() { ... priv->can.bitrate_max = 20 * MEGA /* BPS */; ... } So bitrate_max is non-zero on the reproduction driver. The second argument in the paragraph still holds. can_changelink() calls can_get_bittiming() before it checks the limit: drivers/net/can/dev/netlink.c:can_changelink() { ... err = can_get_bittiming(dev, &bt, priv->bittiming_const, ... if (priv->bitrate_max && bt.bitrate > priv->bitrate_max) { ... } The data bittiming path follows the same order. The code change itself looks correct. Could the paragraph drop the "zero for most drivers" reasoning and keep only the ordering argument? -- Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-bittiming-fix-conversion-v2-0-36e8a0275923%40pengutronix.de