mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-17 17:24:17 +08:00
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 <yongjun_wei@trendmicro.com.cn> Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
parent
788b0bc465
commit
7042e8f2f6
@ -440,7 +440,7 @@ ep_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
|
|||||||
|
|
||||||
value = -ENOMEM;
|
value = -ENOMEM;
|
||||||
kbuf = memdup_user(buf, len);
|
kbuf = memdup_user(buf, len);
|
||||||
if (!kbuf) {
|
if (IS_ERR(kbuf)) {
|
||||||
value = PTR_ERR(kbuf);
|
value = PTR_ERR(kbuf);
|
||||||
goto free1;
|
goto free1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user