[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <sf5u53uyu7wjm5g67ecsqctqis3lq6hrjhzzwbfj7pzss2nsbn@bwljug5xrvx6>
Date: Wed, 22 Jan 2025 21:36:23 +0300
From: Fedor Pchelkin <pchelkin@...ras.ru>
To: Nikita Zhandarovich <n.zhandarovich@...tech.ru>
Cc: Petko Manolov <petkan@...leusys.com>, lvc-project@...uxtesting.org,
netdev@...r.kernel.org, linux-usb@...r.kernel.org, syzkaller-bugs@...glegroups.com,
syzbot+d7e968426f644b567e31@...kaller.appspotmail.com, linux-kernel@...r.kernel.org,
Andrew Lunn <andrew+netdev@...n.ch>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
"David S. Miller" <davem@...emloft.net>, Alan Stern <stern@...land.harvard.edu>
Subject: Re: [PATCH net] net: usb: rtl8150: enable basic endpoint checking
On Wed, 22. Jan 02:42, Nikita Zhandarovich wrote:
> @@ -880,6 +888,20 @@ static int rtl8150_probe(struct usb_interface *intf,
> return -ENOMEM;
> }
>
> + /* Verify that all required endpoints are present */
> + static const u8 bulk_ep_addr[] = {
> + RTL8150_USB_EP_BULK_IN | USB_DIR_IN,
> + RTL8150_USB_EP_BULK_OUT | USB_DIR_OUT,
> + 0};
> + static const u8 int_ep_addr[] = {
> + RTL8150_USB_EP_INT_IN | USB_DIR_IN,
> + 0};
nit: It's better to avoid using mixed declarations and code, especially
if the patch is considered to be a material for stable branches.
When building old kernels which lack b5ec6fd286df ("kbuild: Drop
-Wdeclaration-after-statement"), the following unnecessary warning
occurs:
drivers/net/usb/rtl8150.c: In function ‘rtl8150_probe’:
drivers/net/usb/rtl8150.c:892:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
892 | static const u8 bulk_ep_addr[] = {
| ^~~~~~
> + if (!usb_check_bulk_endpoints(intf, bulk_ep_addr) ||
> + !usb_check_int_endpoints(intf, int_ep_addr)) {
> + dev_err(&intf->dev, "couldn't find required endpoints\n");
> + goto out;
> + }
> +
> tasklet_setup(&dev->tl, rx_fixup);
> spin_lock_init(&dev->rx_pool_lock);
>
Powered by blists - more mailing lists