1
0
Fork 0

greybus: svc: error out only for smaller payloads received

!= was used in place of <, while comparing expected and actual payload
size. The module may be running a higher version of the protocol and
might have some extra fields (towards the end) in the structure, and the
AP needs to ignore them.

This also updates the print (expected-payload-size <
actual-payload-size), when the size doesn't match for requests received
by the module. This gives more details required for debugging.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
hifive-unleashed-5.1
Viresh Kumar 2015-08-11 07:29:19 +05:30 committed by Greg Kroah-Hartman
parent 10c7ae04e3
commit 0c32d2a5b2
1 changed files with 2 additions and 2 deletions

View File

@ -193,8 +193,8 @@ static int gb_svc_hello(struct gb_operation *op)
* SVC sends information about the endo and interface-id on the hello
* request, use that to create an endo.
*/
if (op->request->payload_size != sizeof(*hello_request)) {
dev_err(dev, "%s: Illegal size of hello request (%zu %zu)\n",
if (op->request->payload_size < sizeof(*hello_request)) {
dev_err(dev, "%s: Illegal size of hello request (%zu < %zu)\n",
__func__, op->request->payload_size,
sizeof(*hello_request));
return -EINVAL;