Linux-i3c Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sam Agazaryan" <samagazaryan@google.com>
Cc: linux-i3c@lists.infradead.org, Frank.Li@kernel.org,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>
Subject: Re: [PATCH v5 3/5] i3c: use actual_len for read transfers
Date: Mon, 21 Sep 2026 23:16:57 +0000	[thread overview]
Message-ID: <20260921231658.45F391F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260921230603.2518652-4-samagazaryan@google.com>

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@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

-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

  reply	other threads:[~2026-09-21 23:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 23:05 [PATCH v5 0/5] i3c: add i3cdev module to expose i3c dev in /dev Sam Agazaryan
2026-09-21 23:05 ` [PATCH v5 1/5] i3c: master: export i3c_masterdev_type Sam Agazaryan
2026-09-21 23:06 ` [PATCH v5 2/5] i3c: master: add i3c_for_each_dev helper Sam Agazaryan
2026-09-21 23:06 ` [PATCH v5 3/5] i3c: use actual_len for read transfers Sam Agazaryan
2026-09-21 23:16   ` sashiko-bot [this message]
2026-09-24 11:53   ` Adrian Hunter
2026-09-25 15:25   ` Frank Li
2026-09-28 10:42     ` Adrian Hunter
2026-09-21 23:06 ` [PATCH v5 4/5] i3c: add i3cdev module to expose i3c dev in /dev Sam Agazaryan
2026-09-21 23:21   ` sashiko-bot
2026-09-25 15:38   ` Frank Li
2026-09-21 23:06 ` [PATCH v5 5/5] tools: i3c: add i3ctransfer utility Sam Agazaryan
2026-09-21 23:15   ` sashiko-bot
2026-09-25  9:08 ` [PATCH v5 0/5] i3c: add i3cdev module to expose i3c dev in /dev Andy Shevchenko
2026-09-25 10:57   ` Wolfram Sang

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=20260921231658.45F391F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-i3c@lists.infradead.org \
    --cc=samagazaryan@google.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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