From: Wei Yongjun Date: Sun, 20 Jul 2014 03:42:07 +0000 (+0800) Subject: usb: gadget: Fix return value check in ep_write() X-Git-Tag: MMI-PSA29.97-13-9~11621^2~15^2~6 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7042e8f2f6f5c76b6173748570312bbeb044c7dd;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git usb: gadget: Fix return value check in ep_write() In case of error, the function memdup_user() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Signed-off-by: Wei Yongjun Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c index 2e4ce7704908..e96077b8bf79 100644 --- a/drivers/usb/gadget/legacy/inode.c +++ b/drivers/usb/gadget/legacy/inode.c @@ -440,7 +440,7 @@ ep_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) value = -ENOMEM; kbuf = memdup_user(buf, len); - if (!kbuf) { + if (IS_ERR(kbuf)) { value = PTR_ERR(kbuf); goto free1; }