[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZSoFDLv8_CG1SGN6@google.com>
Date: Fri, 13 Oct 2023 20:03:40 -0700
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Javier Carrasco <javier.carrasco.cruz@...il.com>
Cc: John Horan <knasher@...il.com>,
Henrik Rydberg <rydberg@...math.org>,
linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
syzbot+348331f63b034f89b622@...kaller.appspotmail.com
Subject: Re: [PATCH v2] Input: bcm5974 - check endpoint type before starting
traffic
Hi Javier,
On Thu, Oct 12, 2023 at 06:51:49PM +0200, Javier Carrasco wrote:
>
> +static bool bcm5974_ep_is_int_in(struct usb_host_interface *iface, int addr)
> +{
> + struct usb_endpoint_descriptor *endpoint;
> + int i;
> +
> + for (i = 0; i < iface->desc.bNumEndpoints; i++) {
> + endpoint = &iface->endpoint[i].desc;
> + if (endpoint->bEndpointAddress == addr) {
> + if (usb_endpoint_is_int_in(endpoint))
> + return true;
> + }
> + }
> + return false;
> +}
This essentially reimplements usb_find_endpoint() in a sense, so can we
instead do:
ep = usb_find_endpoint(iface, addr);
if (!ep || !usb_endpoint_is_int_in(ep)) {
dev_err(...);
return ...;
}
Also it looks like the handling of button endpoint is interleaved with
the trackpad endpoint, I wonder if it would not be better if we have a
separate "if (cfg->tp_type == TYPE1)" where we would do the check,
allocate URB, and did all the rest of set up for button transfers.
Thanks.
--
Dmitry
Powered by blists - more mailing lists