[PATCH] usbip: vudc: check for NULL before use

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



to_vep() is doing a container_of() on _ep. It is better to do the NULL
check first and then use it.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@xxxxxxxxxxxxxxx>
---
 drivers/usb/usbip/vudc_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/usbip/vudc_dev.c b/drivers/usb/usbip/vudc_dev.c
index 968471b..32ea604 100644
--- a/drivers/usb/usbip/vudc_dev.c
+++ b/drivers/usb/usbip/vudc_dev.c
@@ -388,10 +388,10 @@ static int vep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
 	unsigned long flags;
 	int ret = 0;
 
-	ep = to_vep(_ep);
 	if (!_ep)
 		return -EINVAL;
 
+	ep = to_vep(_ep);
 	udc = ep_to_vudc(ep);
 	if (!udc->driver)
 		return -ESHUTDOWN;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux