Re: [PATCH v1 2/3] usb: dwc3: gadget: Add support for snps,reserved-endpoints property

From: Thinh Nguyen
Date: Wed Jan 29 2025 - 20:48:43 EST


On Tue, Jan 28, 2025, Andy Shevchenko wrote:
> On Tue, Jan 28, 2025 at 02:39:50AM +0000, Thinh Nguyen wrote:
> > On Wed, Jan 22, 2025, Andy Shevchenko wrote:
> > > On Wed, Jan 22, 2025 at 01:44:02AM +0000, Thinh Nguyen wrote:
> >
> > No. We track the total num_eps in dwc->num_eps. Then we do for-loop to
> > dwc->eps[i] and access the endpoint. Often we check if the endpoint is
> > NULL before accessing dwc->eps[i]. However, we don't do it everywhere.
> > So I ask for you to review to make sure that this change doesn't break
> > elsewhere where we may try to access dwc->eps[i] to an uninit endpoint
> > (Note I see at least 1 place e.g. dwc3_gadget_clear_tx_fifos that may
> > break)
>
> I see, so having my code as is also requiring to check all users of
> the eps array in the _gadget part_ of the driver to see if they won't
> crash due to NULL pointer dereference. Is it what you want?
> If so, definitely I will revisit that.
>

Yes, help double check that.

Thanks,
Thinh