1 From c526c62d565ea5a5bba9433f28756079734f430d Mon Sep 17 00:00:00 2001
2 From: Peter Chen <peter.chen@nxp.com>
3 Date: Fri, 1 Jul 2016 15:33:28 +0800
4 Subject: usb: gadget: composite: fix dereference after null check coverify warning
6 From: Peter Chen <peter.chen@nxp.com>
8 commit c526c62d565ea5a5bba9433f28756079734f430d upstream.
10 cdev->config is checked for null pointer at above code, so cdev->config
11 might be null, fix it by adding null pointer check.
13 Signed-off-by: Peter Chen <peter.chen@nxp.com>
14 Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
15 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
16 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19 drivers/usb/gadget/composite.c | 2 ++
20 1 file changed, 2 insertions(+)
22 --- a/drivers/usb/gadget/composite.c
23 +++ b/drivers/usb/gadget/composite.c
24 @@ -1819,6 +1819,8 @@ unknown:
27 case USB_RECIP_ENDPOINT:
30 endp = ((w_index & 0x80) >> 3) | (w_index & 0x0f);
31 list_for_each_entry(f, &cdev->config->functions, list) {
32 if (test_bit(endp, f->endpoints))