Re: [PATCH v1 1/3] usb: typec: ucsi: Limit read size on v1.2

From: Prashant Malani
Date: Wed Jan 24 2024 - 03:12:49 EST


Hi Abhishek,

On Tue, Jan 23, 2024 at 2:30 PM Abhishek Pandit-Subedi
<abhishekpandit@xxxxxxxxxx> wrote:
>
> From: Abhishek Pandit-Subedi <abhishekpandit@xxxxxxxxxxxx>
>
> Between UCSI 1.2 and UCSI 2.0, the size of the MESSAGE_IN region was
> increased from 16 to 256. In order to avoid overflowing reads for older
> systems, add a mechanism to use the read UCSI version to truncate read
> sizes on UCSI v1.2.
>
> Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@xxxxxxxxxxxx>
I have one nit (mentioned in side-band but reproducing here for consistency),
but will defer to the maintainer on that.

The above notwithstanding, FWIW:
Reviewed-by: Prashant Malani<pmalani@xxxxxxxxxxxx>

> @@ -1556,6 +1569,15 @@ int ucsi_register(struct ucsi *ucsi)
> if (!ucsi->version)
> return -ENODEV;
>
> + /*
> + * Version format is JJ.M.N (JJ = Major version, M = Minor version,
> + * N = sub-minor version).
> + */
> + dev_info(ucsi->dev, "Registered UCSI interface with version %x.%x%x",
> + UCSI_BCD_GET_MAJOR(ucsi->version),
> + UCSI_BCD_GET_MINOR(ucsi->version),
> + UCSI_BCD_GET_SUBMINOR(ucsi->version));

nit: I think this doesn't need to be dev_info() and can be just
dev_dbg(), but will
defer to the maintainer.

Thanks,

-Prashant