summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Chen <peter.chen@nxp.com>2016-07-01 09:33:28 +0200
committerFelipe Balbi <felipe.balbi@linux.intel.com>2016-08-11 14:09:44 +0200
commitc526c62d565ea5a5bba9433f28756079734f430d (patch)
treefb0f61dada559172c34a6adce673e9303114bf70
parentusb: renesas_usbhs: Use dmac only if the pipe type is bulk (diff)
downloadlinux-c526c62d565ea5a5bba9433f28756079734f430d.tar.xz
linux-c526c62d565ea5a5bba9433f28756079734f430d.zip
usb: gadget: composite: fix dereference after null check coverify warning
cdev->config is checked for null pointer at above code, so cdev->config might be null, fix it by adding null pointer check. Signed-off-by: Peter Chen <peter.chen@nxp.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
-rw-r--r--drivers/usb/gadget/composite.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index eb648485a58c..a8ecc7a612b9 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1913,6 +1913,8 @@ unknown:
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))