RE: [PATCH v2 RESEND] i2c: tegra: check msg length in SMBUS block read

Akhil R
2025-04-29T04:37:37Z

> > I agree with Thierry, this check is driver independent and it
> > should be done in the library. Anyway, for now, I'm going to take
> > this as this check is now left to the drivers and it would be
> > huge to shift it somewhere else.
>
> The big picture is to support SMBUS3 somewhen which allows for 255 byte
> transfers. Besides that, it usually is not possible to check the value
> outside the driver because it has to act on the value right away. That
> is, the length comes in and exactly this number of bytes has to be read
> in the same message,
>
> > Before I merge, I want to know if you have you seen any failure
> > here? What is the reason you are sending it?
>
> Usually some devices just send more bytes because they can. A value of 0
> would be interesting in deed.

Yes. We have had issues where the client device sends '0' as length if the
transfer is terminated abruptly at the client's side. The actual fix is in the client's
driver, but this check here would ensure that the master does not run into
trouble either.

Regards,
Akhil