From: sashiko-bot@kernel.org
To: "Stéphane Grosjean" <stephane.grosjean@free.fr>
Cc: "Vincent Mailhol" <mailhol@kernel.org>,
"Marc Kleine-Budde" <mkl@pengutronix.de>,
"Oliver Hartkopp" <socketcan@hartkopp.net>,
linux-can@vger.kernel.org,
"Oleksij Rempel" <o.rempel@pengutronix.de>
Subject: Re: [PATCH v2] can: peak_usb: Add bus error reporting for the PCAN-USB FD family
Date: Tue, 29 Sep 2026 14:54:00 +0000 [thread overview]
Message-ID: <20260929145401.6FD0C1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260929-peak_usb-canfd-berr-v2-1-1a7005797c38@peak-system.fr>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] can: peak_usb: returning -EINVAL for bogus error reports drops valid URB packets
--
commit 6ff05518907e7981e5fff27d40e8a2458d563751
Author: Stéphane Grosjean <s.grosjean@peak-system.fr>
can: peak_usb: Add bus error reporting for the PCAN-USB FD family
CAN bus error reporting is currently missing for all PEAK-System
USB-to-CAN FD devices. Add support for reporting bus errors by enabling
bus error notifications in the firmware for each CAN channel.
Link to v1: https://patch.msgid.link/20260929-peak_usb-canfd-berr-v1-1-7abd585f877f@peak-system.fr
> diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
> index 0d46f4ce5dca7..98f6943469b33 100644
> --- a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
> +++ b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
> @@ -661,17 +661,71 @@ static int pcan_usb_fd_decode_error(struct pcan_usb_fd_if *usb_if,
> struct pucan_error_msg *er = (struct pucan_error_msg *)rx_msg;
> struct pcan_usb_fd_device *pdev;
> struct peak_usb_device *dev;
> + struct can_frame *cf;
> + struct sk_buff *skb;
> + u8 can_err_tx = 0;
>
> if (pucan_ermsg_get_channel(er) >= ARRAY_SIZE(usb_if->dev))
> return -EINVAL;
>
> + /* Guard against bogus channel 1 reports from single-channel adapters */
> dev = usb_if->dev[pucan_ermsg_get_channel(er)];
> + if (!dev)
> + return -EINVAL;
[Severity: High]
Does returning -EINVAL here cause valid URB packets to be dropped?
The caller pcan_usb_fd_decode_buf() handles a negative return value by
aborting the URB decoding entirely and jumping to the fail label:
case PUCAN_MSG_ERROR:
err = pcan_usb_fd_decode_error(usb_if, rx_msg);
if (err < 0)
goto fail;
break;
Because USB bulk transfers pack multiple CAN records together, aborting
the loop discards any subsequent valid CAN frames in the same URB.
This appears to lead to silent data loss under normal operation.
Should this return 0 instead of -EINVAL to safely ignore the hardware quirk
without dropping the rest of the buffer?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260929-peak_usb-canfd-berr-v2-1-1a7005797c38@peak-system.fr?part=1
next prev parent reply other threads:[~2026-09-29 14:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 14:41 [PATCH v2] can: peak_usb: Add bus error reporting for the PCAN-USB FD family Stéphane Grosjean
2026-09-29 14:54 ` sashiko-bot [this message]
2026-09-30 7:49 ` Stéphane Grosjean
2026-09-30 8:09 ` Marc Kleine-Budde
2026-09-30 8:09 ` Marc Kleine-Budde
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=20260929145401.6FD0C1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=mailhol@kernel.org \
--cc=mkl@pengutronix.de \
--cc=o.rempel@pengutronix.de \
--cc=sashiko-reviews@lists.linux.dev \
--cc=socketcan@hartkopp.net \
--cc=stephane.grosjean@free.fr \
/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