Commit 7a13e2f6 authored by Matt Porter's avatar Matt Porter Committed by Greg Kroah-Hartman

greybus: fix manifest parsing problem with descriptor payload

The internal struct manifest_desc needs the data payload, rather
than the entire descriptor with header to be populated into the
data field. Also fix two places where the parser was trying to
extract the entire descriptor with header for the data payload
field.
Signed-off-by: default avatarMatt Porter <mporter@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent e8caf9a3
...@@ -113,7 +113,7 @@ static int identify_descriptor(struct greybus_descriptor *desc, size_t size) ...@@ -113,7 +113,7 @@ static int identify_descriptor(struct greybus_descriptor *desc, size_t size)
return -ENOMEM; return -ENOMEM;
descriptor->size = desc_size; descriptor->size = desc_size;
descriptor->data = desc; descriptor->data = (u8 *)desc + sizeof(*desc_header);
descriptor->type = desc_header->type; descriptor->type = desc_header->type;
list_add_tail(&descriptor->links, &manifest_descs); list_add_tail(&descriptor->links, &manifest_descs);
...@@ -143,13 +143,11 @@ static char *gb_string_get(u8 string_id) ...@@ -143,13 +143,11 @@ static char *gb_string_get(u8 string_id)
return NULL; return NULL;
list_for_each_entry(descriptor, &manifest_descs, links) { list_for_each_entry(descriptor, &manifest_descs, links) {
struct greybus_descriptor *desc;
if (descriptor->type != GREYBUS_TYPE_STRING) if (descriptor->type != GREYBUS_TYPE_STRING)
continue; continue;
desc = descriptor->data; desc_string = descriptor->data;
desc_string = &desc->string;
if (desc_string->id == string_id) { if (desc_string->id == string_id) {
found = true; found = true;
break; break;
...@@ -262,8 +260,7 @@ static u32 gb_manifest_parse_interfaces(struct gb_module *gmod) ...@@ -262,8 +260,7 @@ static u32 gb_manifest_parse_interfaces(struct gb_module *gmod)
static bool gb_manifest_parse_module(struct gb_module *gmod, static bool gb_manifest_parse_module(struct gb_module *gmod,
struct manifest_desc *module_desc) struct manifest_desc *module_desc)
{ {
struct greybus_descriptor *desc = module_desc->data; struct greybus_descriptor_module *desc_module = module_desc->data;
struct greybus_descriptor_module *desc_module = &desc->module;
/* Handle the strings first--they can fail */ /* Handle the strings first--they can fail */
gmod->vendor_string = gb_string_get(desc_module->vendor_stringid); gmod->vendor_string = gb_string_get(desc_module->vendor_stringid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment