Browse Source

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>
Peter Chen 9 năm trước cách đây
mục cha
commit
c526c62d56
1 tập tin đã thay đổi với 2 bổ sung0 xóa
  1. 2 0
      drivers/usb/gadget/composite.c

+ 2 - 0
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))