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)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Wed, 11 Jun 2014 09:02:20 +0000 (11:02 +0200)
commitc05102aafcd0ad4e749135790be9531c6b488a35
tree831255b36c1aa82c2c530b0438a80e23668414f5
parent932b696e45ac6dc40aaeff67eca550d639910ef2
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