Linux-i3c Archive mirror
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@nxp.com>
To: Alexandre Belloni <alexandre.belloni@bootlin.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 12:29:00 -0500	[thread overview]
Message-ID: <ZaAlXJQuZbej5o+r@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20240111001523f69f6a29@mail.local>

On Thu, Jan 11, 2024 at 01:15:23AM +0100, Alexandre Belloni wrote:
> 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?

Hold on, I found an method. It may support > 255 transfer.

Frank Li

> 
> > +			return -EINVAL;
> > +		}
> >  	}
> >  
> >  	mutex_lock(&master->lock);
> > -- 
> > 2.34.1
> > 
> 
> -- 
> Alexandre Belloni, co-owner and COO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

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

      reply	other threads:[~2024-01-11 17:29 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
2024-01-11 17:29   ` Frank Li [this message]

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=ZaAlXJQuZbej5o+r@lizhi-Precision-Tower-5810 \
    --to=frank.li@nxp.com \
    --cc=alexandre.belloni@bootlin.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).