From fa2fbf16f6aaaabee9394edc57dc803b59de6699 Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Tue, 28 Apr 2015 19:51:35 +0530 Subject: [PATCH] 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 Reviewed-by: Johan Hovold Signed-off-by: Viresh Kumar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/manifest.c | 3 +++ 1 file changed, 3 insertions(+) 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);