]> git.karo-electronics.de Git - karo-tx-linux.git/commit
greybus: enforce receive buffer size
authorAlex Elder <elder@linaro.org>
Tue, 25 Nov 2014 19:06:45 +0000 (13:06 -0600)
committerGreg Kroah-Hartman <greg@kroah.com>
Tue, 25 Nov 2014 21:21:14 +0000 (13:21 -0800)
commitaa3a4d12093b818ac2b9fe3e0454ae0090201254
tree95a21c8501ff5d538f9c8e55f027ae4177581b0b
parent1a365154c24a3fd48b96ad25cb67a483124d56ad
greybus: enforce receive buffer size

When an operation is created its receive buffer size is specified.
In all current cases, the size supplied for the receive buffer is
exactly the size that should be returned.  In other words, if
any fewer than that many bytes arrived in a response, it would be
an error.

So tighten the check on the number of bytes arriving for a response
message, ensuring that the number of bytes received is *exactly the
same* as the number of bytes available (rather than just less than).
We'll expand our interpretation of of -EMSGSIZE to mean "wrong
message size" rather than just "message too long."

If we someday encounter an actual case where we want to be able to
successfully receive something less than the full receive buffer we
can adjust the code to handle that (and give it a way to tell the
receiver how many bytes are present).

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/staging/greybus/operation.c