Skip to contentSkip to conversation

usb: dwc2: host: Fix ISOC flow in DDMA mode

bug report Dan Carpenter 3 participants 3 messages Apr 5, 2024 – Apr 8, 2024 USB

lore
Share & tools
lore
#0 lore raw

Hello Minas Harutyunyan,

This is a semi-automatic email about new static checker warnings.

Commit b258e4268850 ("usb: dwc2: host: Fix ISOC flow in DDMA mode") from Mar 13, 2024, leads to the following Smatch complaint:

    drivers/usb/dwc2/hcd_ddma.c:874 dwc2_cmpl_host_isoc_dma_desc()
    warn: variable dereferenced before check 'qtd->urb' (see line 870)

drivers/usb/dwc2/hcd_ddma.c
869 u16 frame_desc_idx;

   870		struct urb *usb_urb = qtd->urb->priv;
                                      ^^^^^^^^^^

The patch adds a dereference

871 u16 remain = 0;
872 int rc = 0;
873
874 if (!qtd->urb)

                    ^^^^^^^^^

The existing check is too late now

875 return -EINVAL;
876

regards,
dan carpenter

#1 lore raw

Hi Greg,

Quoted 21 lines · Dan Carpenter

Hello Minas Harutyunyan,

This is a semi-automatic email about new static checker warnings.

Commit b258e4268850 ("usb: dwc2: host: Fix ISOC flow in DDMA mode") from Mar 13, 2024, leads to the following Smatch complaint:

     drivers/usb/dwc2/hcd_ddma.c:874 dwc2_cmpl_host_isoc_dma_desc()
     warn: variable dereferenced before check 'qtd->urb' (see line 870)

drivers/usb/dwc2/hcd_ddma.c

    869		u16 frame_desc_idx;
    870		struct urb *usb_urb = qtd->urb->priv;
                                       ^^^^^^^^^^

The patch adds a dereference

    871		u16 remain = 0;
    872		int rc = 0;
    873	
    874		if (!qtd->urb)
                     ^^^^^^^^^
Quoted 7 lines

The existing check is too late now

    875			return -EINVAL;
    876	

regards,
dan carpenter

Should I send new version of this patch or should develop fixup patch to be applied to "usb-linus" branch?

#2 lore raw
Quoted 26 lines · Minas Harutyunyan

Hi Greg,

Quoted 23 lines · Dan Carpenter

Hello Minas Harutyunyan,

This is a semi-automatic email about new static checker warnings.

Commit b258e4268850 ("usb: dwc2: host: Fix ISOC flow in DDMA mode") from Mar 13, 2024, leads to the following Smatch complaint:

     drivers/usb/dwc2/hcd_ddma.c:874 dwc2_cmpl_host_isoc_dma_desc()
     warn: variable dereferenced before check 'qtd->urb' (see line 870)

drivers/usb/dwc2/hcd_ddma.c

    869		u16 frame_desc_idx;
    870		struct urb *usb_urb = qtd->urb->priv;
                                       ^^^^^^^^^^

The patch adds a dereference

    871		u16 remain = 0;
    872		int rc = 0;
    873	
    874		if (!qtd->urb)
                     ^^^^^^^^^

The existing check is too late now

Quoted 8 lines
Quoted 5 lines
    875			return -EINVAL;
    876	

regards,
dan carpenter

Should I send new version of this patch or should develop fixup patch to be applied to "usb-linus" branch?

A fixup patch please, I can not rebase this tree.

thanks,

greg k-h