layout: Make `romentry.name` a pointer
This should provide more flexibility while we don't have to allocate
256B extra per layout entry.
Change-Id: Ibb903113550ec13f43cbbd0a412c8f35fe1cf454
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/33515
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/ich_descriptors.c b/ich_descriptors.c
index 251f636..0a4cf75 100644
--- a/ich_descriptors.c
+++ b/ich_descriptors.c
@@ -1153,7 +1153,8 @@
* @param len The length of the descriptor dump.
*
* @return 0 on success,
- * 1 if the descriptor couldn't be parsed.
+ * 1 if the descriptor couldn't be parsed,
+ * 2 when out of memory.
*/
int layout_from_ich_descriptors(struct ich_layout *const layout, const void *const dump, const size_t len)
{
@@ -1178,7 +1179,9 @@
layout->entries[j].start = base;
layout->entries[j].end = limit;
layout->entries[j].included = false;
- snprintf(layout->entries[j].name, sizeof(layout->entries[j].name), "%s", regions[i]);
+ layout->entries[j].name = strdup(regions[i]);
+ if (!layout->entries[j].name)
+ return 2;
++j;
}
layout->base.entries = layout->entries;