From: Viresh Kumar Date: Tue, 28 Apr 2015 14:21:35 +0000 (+0530) Subject: greybus: manifest: Account for padding in string descriptor X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fa2fbf16f6aaaabee9394edc57dc803b59de6699;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 --- 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);