[PATCH v5 3/5] i3c: use actual_len for read transfers
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Mon Sep 21 16:16:57 PDT 2026
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] net/mctp: mctp_i3c_read() uses xfer.len instead of xfer.actual_len for stats
--
commit ff8e6e542d5759da3d1770a07040b513a924c331
Author: Sam Agazaryan <samagazaryan at google.com>
i3c: use actual_len for read transfers
This commit unifies read length reporting across the I3C subsystem by using
actual_len for reads. It updates several controller drivers and the mctp-i3c
driver to use actual_len without mutating len.
> diff --git a/drivers/net/mctp/mctp-i3c.c b/drivers/net/mctp/mctp-i3c.c
> index 4e857dd5df642..5324385be8c01 100644
> --- a/drivers/net/mctp/mctp-i3c.c
> +++ b/drivers/net/mctp/mctp-i3c.c
[ ... ]
> @@ -145,15 +145,15 @@ static int mctp_i3c_read(struct mctp_i3c_device *mi)
> /* check PEC, including address byte */
> addr = mi->addr << 1 | 1;
> pec = i2c_smbus_pec(0, &addr, 1);
> - pec = i2c_smbus_pec(pec, xfer.data.in, xfer.len - 1);
> - if (pec != ((u8 *)xfer.data.in)[xfer.len - 1]) {
> + pec = i2c_smbus_pec(pec, xfer.data.in, xfer.actual_len - 1);
> + if (pec != ((u8 *)xfer.data.in)[xfer.actual_len - 1]) {
> stats->rx_crc_errors++;
> rc = -EINVAL;
> goto err;
> }
>
> /* Remove PEC */
> - skb_trim(skb, xfer.len - 1);
> + skb_trim(skb, xfer.actual_len - 1);
>
> cb = __mctp_cb(skb);
> cb->halen = PID_SIZE;
[Severity: Medium]
Does mctp_i3c_read() also need to use xfer.actual_len when updating the
network statistics?
A few lines below this hunk, the code still updates the rx_bytes counter
using the unmutated xfer.len:
if (net_status == NET_RX_SUCCESS) {
stats->rx_packets++;
stats->rx_bytes += xfer.len - 1;
} else {
stats->rx_dropped++;
}
Will this inflate the rx_bytes counter by the maximum requested read length
(mi->mrl) rather than the actual received bytes?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260921230603.2518652-1-samagazaryan@google.com?part=3
More information about the linux-i3c
mailing list