]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/usb/gadget/composite.c
usb: gadget: composite: fix dereference after null check coverify warning
[linux.git] / drivers / usb / gadget / composite.c
index eb648485a58c571001c4e31b7c79aadaaee04445..a8ecc7a612b930e47db97917b5a07c6d2e6eff3c 100644 (file)
@@ -1913,6 +1913,8 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
                        break;
 
                case USB_RECIP_ENDPOINT:
+                       if (!cdev->config)
+                               break;
                        endp = ((w_index & 0x80) >> 3) | (w_index & 0x0f);
                        list_for_each_entry(f, &cdev->config->functions, list) {
                                if (test_bit(endp, f->endpoints))