usb: gadget: return the right length in ffs_epfile_io()
authorChuansheng Liu <chuansheng.liu@intel.com>
Tue, 4 Mar 2014 07:34:57 +0000 (15:34 +0800)
committerChanho Park <chanho61.park@samsung.com>
Thu, 7 Aug 2014 05:32:06 +0000 (14:32 +0900)
commit64536088d017c2bbb8d3b44900b0468135683372
treee5ad9cfd87d0f5a7e14de4e779ab25e1a9a8defd
parentc85f82bceca59662e353560adbd6353fddfc345c
usb: gadget: return the right length in ffs_epfile_io()

When the request length is aligned to maxpacketsize, sometimes
the return length ret > the user space requested len.

At that time, we will use min_t(size_t, ret, len) to limit the
size in case of user data buffer overflow.

But we need return the min_t(size_t, ret, len) to tell the user
space rightly also.

[ balbi@ti.com: also fix comment's indentation ]

Acked-by: Michal Nazarewicz <mina86@mina86.com>
Reviewed-by: David Cohen <david.a.cohen@linux.intel.com>
Signed-off-by: Chuansheng Liu <chuansheng.liu@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[backport from upstream commit cfe919b53b807ab32e89e1c662c6d242948449bd]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-id: Icfe919b53b807ab32e89e1c662c6d242948449bd
drivers/usb/gadget/f_fs.c