Re: [PATCH can-next 07/13] can: gs_usb: gs_usb_receive_bulk_callback(): reduce scope of several variables
[email protected] Mon, 20 Jul 2026 14:00:23 +0000
| Newsgroups | org.kernel.vger.linux-can |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: Pre-existing issues: - [High] Returning directly on SKB allocation failure drops the USB URB instead of resubmitting it, permanently reducing the RX URB pool and potentially stalling the receiver entirely. -- --- Patch [7]: [PATCH can-next 07/13] can: gs_usb: gs_usb_receive_bulk_callback(): reduce scope of several variables --- commit 2f6b205703c7b1ac4e58ba90c1e5b7687566e6e9 Author: Marc Kleine-Budde <[email protected]> can: gs_usb: gs_usb_receive_bulk_callback(): reduce scope of several variables This patch improves code readability by reducing the scope of variables txc, cf, cfd, and skb in gs_usb_receive_bulk_callback(). > diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c > --- a/drivers/net/can/usb/gs_usb.c > +++ b/drivers/net/can/usb/gs_usb.c [ ... ] > @@ -705,7 +701,11 @@ static void gs_usb_receive_bulk_callback(struct urb *urb) > } > > if (hf->echo_id == GS_HOST_FRAME_ECHO_ID_RX) { /* normal rx */ > + struct sk_buff *skb; > + > if (hf->flags & GS_CAN_FLAG_FD) { > + struct canfd_frame *cfd; > + > skb = alloc_canfd_skb(netdev, &cfd); > if (!skb) > return; [Severity: High] This is a pre-existing issue, but does returning directly on skb allocation failure drop the USB URB instead of resubmitting it? If enough skb allocations fail under memory pressure, it seems the RX URB pool will permanently decrease. Could this eventually stall the receiver entirely, requiring the interface to be brought down and back up to recover? Should this failure path go to the resubmit_urb label instead? > @@ -719,6 +719,8 @@ static void gs_usb_receive_bulk_callback(struct urb *urb) > > memcpy(cfd->data, hf->canfd->data, data_length); > } else { > + struct can_frame *cf; > + > skb = alloc_can_skb(netdev, &cf); > if (!skb) > return; [Severity: High] This is also a pre-existing issue, but does this allocation failure also leak the URB by returning directly rather than resubmitting? -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=7