greybus: loopback: add response len to loopback protocol
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>
Mon, 14 Sep 2015 09:48:45 +0000 (10:48 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Tue, 15 Sep 2015 04:38:12 +0000 (21:38 -0700)
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 <bryan.odonoghue@linaro.org>
Reviewed-by: Patrick Titiano <ptitiano@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/greybus_protocols.h
drivers/staging/greybus/loopback.c

index 77a7c4956929bdeb6d6fe023fca6f0cdb4733a96..76fea9a8ef273cf39b64c3c97fe80b14134dd108 100644 (file)
@@ -917,6 +917,7 @@ struct gb_loopback_transfer_request {
 } __packed;
 
 struct gb_loopback_transfer_response {
+       __le32  len;
        __u8    data[0];
 } __packed;
 
index a9b901fbeb5c475600144dcf19e51cb61f4105c3..ba65457f9f705fd246560438b6955299c49447c4 100644 (file)
@@ -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;