usb: raw-gadget: Fix copy_to/from_user() checks
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 6 Apr 2020 14:51:19 +0000 (17:51 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Apr 2020 12:52:10 +0000 (14:52 +0200)
commit068fbff4f860c620c8e36641c1da9a165abad24e
tree473eeed7f6e5b644599b17267f5882dd1b790832
parent97341ef7070d984305aaefe8b713491e3213d6ab
usb: raw-gadget: Fix copy_to/from_user() checks

The copy_to/from_user() functions return the number of bytes remaining
but we want to return negative error codes.  I changed a couple checks
in raw_ioctl_ep_read() and raw_ioctl_ep0_read() to show that we still
we returning zero on error.

Fixes: f2c2e717642c ("usb: gadget: add raw-gadget interface")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Andrey Konovalov <andreyknvl@google.com>
Tested-by: Andrey Konovalov <andreyknvl@google.com>
Link: https://lore.kernel.org/r/20200406145119.GG68494@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/legacy/raw_gadget.c