Linux CAN drivers development
 help / color / mirror / Atom feed
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, 25031212351@stu.xidian.edu.cn,
	stable@vger.kernel.org, byu@xidian.edu.cn,
	wencheng@xidian.edu.cn, kuba@kernel.org
Subject: Re: [PATCH can-next v3 4/6] can: bittiming: register_candev(): reject unusable bit-timing constants
Date: Wed, 02 Dec 2026 02:07:56 +0000	[thread overview]
Message-ID: <179617727666.3142.12661724725529519319@kernel.org> (raw)
In-Reply-To: <20261130-bittiming-fix-conversion-v3-4-e61f92dc76d0@pengutronix.de>

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 says "Also limit the bit time to
  CAN_MAX_BIT_TIME_TQ", but the patch defines and uses a macro named…

--

can: bittiming: register_candev(): reject unusable bit-timing constants

This commit extends can_bittiming_const_valid() so that register_candev()
rejects bit-timing constants that would cause a division by zero or an
unbounded loop in can_calc_bittiming(). It also adds
can_pwm_const_valid(), requires a non-zero clock frequency, and checks
that the CAN-CC, CAN-FD, CAN XL and XL PWM constants are registered in
the required order.

> Also limit the bit time to CAN_MAX_BIT_TIME_TQ. The loop in
> can_calc_bittiming() walks all time segment candidates from the maxima down
> to the minima; with a bit time near U32_MAX its bounds wrap around and the
> loop does not terminate while RTNL is held. The bit times of the currently
> supported controllers stay well below the limit.

[Severity: Low]
This isn't a bug, but the macro name in the commit message doesn't match
the code. The patch defines and uses CAN_BIT_TIME_TQ_MAX in
drivers/net/can/dev/dev.c:

    #define CAN_BIT_TIME_TQ_MAX 1024

and can_bittiming_const_valid() checks:

    bit_time > CAN_BIT_TIME_TQ_MAX

No symbol named CAN_MAX_BIT_TIME_TQ exists in the tree. Could the
changelog use CAN_BIT_TIME_TQ_MAX instead?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-bittiming-fix-conversion-v3-0-e61f92dc76d0%40pengutronix.de

  reply	other threads:[~2026-12-02  2:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 13:06 [PATCH can-next v3 0/6] can: bittiming: fix defects in the userspace bit rate conversion and reject invalid timing constants Marc Kleine-Budde
2026-11-30 13:06 ` [PATCH can-next v3 1/6] can: bittiming: can_calc_bittiming(): fix potential divide-by-zero Marc Kleine-Budde
2026-12-02  2:07   ` netdev-bot+sashiko
2026-11-30 13:06 ` [PATCH can-next v3 2/6] can: bittiming: can_calc_bittiming(): fix bitrate error calculation on unsigned operands Marc Kleine-Budde
2026-12-02  2:07   ` netdev-bot+sashiko
2026-11-30 13:06 ` [PATCH can-next v3 3/6] can: bittiming: can_update_sample_point(): fix sample point " Marc Kleine-Budde
2026-12-02  2:07   ` netdev-bot+sashiko
2026-11-30 13:06 ` [PATCH can-next v3 4/6] can: bittiming: register_candev(): reject unusable bit-timing constants Marc Kleine-Budde
2026-12-02  2:07   ` netdev-bot+sashiko [this message]
2026-11-30 13:06 ` [PATCH can-next v3 5/6] can: bittiming: can_bittiming_const_valid(): reject unusable BRP bit timing constant Marc Kleine-Budde
2026-12-02  2:07   ` netdev-bot+sashiko
2026-11-30 13:06 ` [PATCH can-next v3 6/6] can: bittiming: can_fixup_bittiming(): reject too high values for prop-seg/phase-seg1 Marc Kleine-Budde
2026-12-02  2:07   ` netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179617727666.3142.12661724725529519319@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=25031212351@stu.xidian.edu.cn \
    --cc=byu@xidian.edu.cn \
    --cc=davem@davemloft.net \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=mailhol@kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=socketcan@hartkopp.net \
    --cc=stable@vger.kernel.org \
    --cc=wencheng@xidian.edu.cn \
    --cc=wg@grandegger.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox