lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250122014347.fc3ntfkl7cismjxd@synopsys.com>
Date: Wed, 22 Jan 2025 01:44:02 +0000
From: Thinh Nguyen <Thinh.Nguyen@...opsys.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
CC: Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Felipe Balbi <balbi@...nel.org>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Rob Herring <robh@...nel.org>,
        Krzysztof Kozlowski <krzk+dt@...nel.org>,
        Conor Dooley <conor+dt@...nel.org>, Ferry Toth <fntoth@...il.com>
Subject: Re: [PATCH v1 2/3] usb: dwc3: gadget: Add support for
 snps,reserved-endpoints property

On Fri, Jan 17, 2025, Andy Shevchenko wrote:
> On Thu, Jan 16, 2025 at 11:35:19PM +0000, Thinh Nguyen wrote:
> > On Thu, Jan 16, 2025, Andy Shevchenko wrote:
> 
> ...
> 
> > >  	for (epnum = 0; epnum < total; epnum++) {
> > > -		int			ret;
> > > +		for (num = 0; num < count; num++) {
> > > +			if (epnum == eps[num])
> > > +				break;
> > > +		}
> > > +		if (num < count)
> > > +			continue;
> > 
> > You can probably rewrite this logic better.
> 
> Any suggestions?
> 
> Thanks for the review!
> 

From the first look, is the list sorted? If so, you don't need another
for-loop.

Also, we loop over the number of endpoints throughout the driver, but
you only skip it here during init. Please double check for invalid
accessing of endpoints in other places.

Perhaps set the dwc->eps[reserved_ep] to ERR_PTR(-EINVAL) or something
when you parse the reserved endpoints so you can skip them in your loop.

BR,
Thinh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ