summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/manifest.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2015-04-29 11:02:08 +0530
committerGreg Kroah-Hartman <gregkh@google.com>2015-04-29 15:55:21 +0200
commit55b930cd17a7cd66a1fb2a587660a344ea5a9ee2 (patch)
tree522f8a745f2b568c20d20d37113ad9d0a5b021c6 /drivers/staging/greybus/manifest.c
parentfa2fbf16f6aaaabee9394edc57dc803b59de6699 (diff)
greybus: manifest: Warn if descriptor size > expected size
A descriptor passed to AP can be bigger than what AP expects, if manifest's minor version is higher with same major number as the AP. As it can have some extra data in descriptor. But, if AP and manifest versions are identical, or if the AP's minor version is greater than the manifest version, we should at least warn (if not fail). Doing this would require some changes to record the manifest version somewhere reachable by identify_descriptor(). For now, just warn if descriptor is bigger than expected. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Alex Elder <elder@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.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/staging/greybus/manifest.c b/drivers/staging/greybus/manifest.c
index 12536637536c..2346ead2a977 100644
--- a/drivers/staging/greybus/manifest.c
+++ b/drivers/staging/greybus/manifest.c
@@ -129,6 +129,13 @@ static int identify_descriptor(struct gb_interface *intf,
return -EINVAL;
}
+ /* Descriptor bigger than what we expect */
+ if (desc_size > expected_size) {
+ pr_warn("%s descriptor size mismatch (want %zu got %zu)\n",
+ get_descriptor_type_string(desc_header->type),
+ expected_size, desc_size);
+ }
+
descriptor = kzalloc(sizeof(*descriptor), GFP_KERNEL);
if (!descriptor)
return -ENOMEM;