Re: [PATCH] usb: gadget: f_fs: report error if excess data received

From: Felipe Balbi
Date: Wed May 11 2016 - 07:08:32 EST



Hi,

changbin.du@xxxxxxxxx writes:
> From: "Du, Changbin" <changbin.du@xxxxxxxxx>
>
> Since the buffer size for req is rounded up to maxpacketsize,
> then we may end up with more data then user space has space
> for.

only for OUT direction with the controller you're using ;-)

> If it happen, we can keep the excess data for next i/o, or
> report an error. But we cannot silently drop data, because
> USB layer should ensure the data integrality it has transferred,
> otherwise applications may get corrupt data if it doesn't
> detect this case.

and when has this actually happened ? Host should not send more data in
this case, if it does, it's an error on the host side. Also, returning
-EOVERFLOW is not exactly correct here, because you'd violate POSIX
specification of read(), right ?

> Here, we simply report an error to userspace to let userspace
> proccess. Actually, userspace applications should negotiate

no, this violates POSIX. Care to explain what problem are you actually
facing ?

--
balbi

Attachment: signature.asc
Description: PGP signature