Re: [PATCH v5 1/8] scsi: ufs: enable WriteBooster on some pre-3.1 UFS devices

From: Stanley Chu
Date: Thu May 07 2020 - 19:51:05 EST


Hi Avri,
On Mon, 2020-05-04 at 22:33 +0800, Stanley Chu wrote:
> Hi Avri,
>
> On Mon, 2020-05-04 at 10:37 +0000, Avri Altman wrote:
> > >
> > > static void ufshcd_wb_probe(struct ufs_hba *hba, u8 *desc_buf)
> > > {
> > > + if (!ufshcd_is_wb_allowed(hba))
> > > + return;
> > > +
> > > + if (hba->desc_size.dev_desc <=
> > > DEVICE_DESC_PARAM_EXT_UFS_FEATURE_SUP)
> > Should be
> > DEVICE_DESC_PARAM_EXT_UFS_FEATURE_SUP + 4
>
> I think this description length check is redundant because the device
> quirk shall be added only after WriteBooster supportat is confirmed in
> attached UFS device. So I will remove this in next version.

Sorry this statement is incorrect because this kind on devices may have
short (without DEVICE_DESC_PARAM_EXT_UFS_FEATURE_SUP field) before
firmware upgrading. So the checking for descriptor length is still
required to avoid out-of-boundary access in below codes.

I will add it back in next version and also fix the length.

Thanks,
Stanley Chu

> >
> > _______________________________________________
> > Linux-mediatek mailing list
> > Linux-mediatek@xxxxxxxxxxxxxxxxxxx
> > http://lists.infradead.org/mailman/listinfo/linux-mediatek
>