summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/manifest.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2015-04-28 19:51:35 +0530
committerGreg Kroah-Hartman <gregkh@google.com>2015-04-29 15:53:18 +0200
commitfa2fbf16f6aaaabee9394edc57dc803b59de6699 (patch)
tree549adabd576f3e0f75eb1ac74a0ea98d4e28e915 /drivers/staging/greybus/manifest.c
parentaf6e8b42334c92b2dcbb93e79b0e7ba4f1d51bb4 (diff)
greybus: manifest: Account for padding in string descriptor
String descriptors are padded towards the end to align them to 4 byte boundaries. Take that into account while calculating expected size. Reviewed-by: Alex Elder <elder@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/manifest.c')
-rw-r--r--drivers/staging/greybus/manifest.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/staging/greybus/manifest.c b/drivers/staging/greybus/manifest.c
index d6cafebefd26..12536637536c 100644
--- a/drivers/staging/greybus/manifest.c
+++ b/drivers/staging/greybus/manifest.c
@@ -100,6 +100,9 @@ static int identify_descriptor(struct gb_interface *intf,
case GREYBUS_TYPE_STRING:
expected_size += sizeof(struct greybus_descriptor_string);
expected_size += desc->string.length;
+
+ /* String descriptors are padded to 4 byte boundaries */
+ expected_size = ALIGN(expected_size, 4);
break;
case GREYBUS_TYPE_INTERFACE:
expected_size += sizeof(struct greybus_descriptor_interface);