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>
Tue, 18 Nov 2014 02:59:44 +0000 (11:59 +0900)
commit1fd06f3b573eb2bcda7fbc39e1e3d84fc51582fc
tree6027b062484e97a014af3f2b05ebd495602c3743
parenta8490d15b767a56e4cbb8de14f2e62d1c7bc5fc0
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