From: Bryan O'Donoghue Date: Mon, 14 Sep 2015 09:48:45 +0000 (+0100) Subject: greybus: loopback: add response len to loopback protocol X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4a655ad4c2b83815ccab5057e29bf0f6c981a94e;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git greybus: loopback: add response len to loopback protocol This patch adds a len field to the loopback protocol. This field is validated in gb_loopback_transfer() and stuffed in gb_loopback_request_recv(). Signed-off-by: Bryan O'Donoghue Reviewed-by: Patrick Titiano Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/greybus_protocols.h b/drivers/staging/greybus/greybus_protocols.h index 77a7c4956929..76fea9a8ef27 100644 --- a/drivers/staging/greybus/greybus_protocols.h +++ b/drivers/staging/greybus/greybus_protocols.h @@ -917,6 +917,7 @@ struct gb_loopback_transfer_request { } __packed; struct gb_loopback_transfer_response { + __le32 len; __u8 data[0]; } __packed; diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c index a9b901fbeb5c..ba65457f9f70 100644 --- a/drivers/staging/greybus/loopback.c +++ b/drivers/staging/greybus/loopback.c @@ -524,6 +524,7 @@ static int gb_loopback_request_recv(u8 type, struct gb_operation *operation) return -ENOMEM; } response = operation->response->payload; + response->len = cpu_to_le32(len); memcpy(response->data, request->data, len); } return 0;