public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Frank Li <Frank.Li@nxp.com>
Cc: conor.culhane@silvaco.com, imx@lists.linux.dev, joe@perches.com,
	linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org,
	miquel.raynal@bootlin.com, zbigniew.lukwinski@linux.intel.com
Subject: Re: [PATCH 1/1] i3c: master: svc: return error when read length bigger than 255
Date: Thu, 11 Jan 2024 01:15:23 +0100	[thread overview]
Message-ID: <20240111001523f69f6a29@mail.local> (raw)
In-Reply-To: <20240110222503.2381599-1-Frank.Li@nxp.com>

On 10/01/2024 17:25:03-0500, Frank Li wrote:
> RDTERM in MCTRL is 8 bits. Add a length check to prevent silent data errors
> when the read length exceeds 255 bytes during each i3c_priv_xfer operation.
> 
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
> ---
>  drivers/i3c/master/svc-i3c-master.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
> index bd10bb698da0f..181b56953fb28 100644
> --- a/drivers/i3c/master/svc-i3c-master.c
> +++ b/drivers/i3c/master/svc-i3c-master.c
> @@ -1375,6 +1375,11 @@ static int svc_i3c_master_priv_xfers(struct i3c_dev_desc *dev,
>  		cmd->len = xfers[i].len;
>  		cmd->actual_len = xfers[i].rnw ? xfers[i].len : 0;
>  		cmd->continued = (i + 1) < nxfers;
> +
> +		if (cmd->rnw && cmd->len > 255) {
> +			dev_err(master->dev, "only support read less than 255 each xfer\n");

What would be the end user action upon seeing this message? Is it actually
useful?

> +			return -EINVAL;
> +		}
>  	}
>  
>  	mutex_lock(&master->lock);
> -- 
> 2.34.1
> 

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2024-01-11  0:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-10 22:25 [PATCH 1/1] i3c: master: svc: return error when read length bigger than 255 Frank Li
2024-01-11  0:15 ` Alexandre Belloni [this message]
2024-01-11 17:29   ` Frank Li

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=20240111001523f69f6a29@mail.local \
    --to=alexandre.belloni@bootlin.com \
    --cc=Frank.Li@nxp.com \
    --cc=conor.culhane@silvaco.com \
    --cc=imx@lists.linux.dev \
    --cc=joe@perches.com \
    --cc=linux-i3c@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=zbigniew.lukwinski@linux.intel.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