1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-02 14:33:18 +02:00

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>
This commit is contained in:
Nico Huber
2019-06-15 14:56:19 +02:00
parent 4f213285d7
commit 70461a9524
5 changed files with 39 additions and 17 deletions

View File

@ -20,6 +20,7 @@
* Have a look at the Modules section for a function reference.
*/
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
@ -384,9 +385,12 @@ static int flashrom_layout_parse_fmap(struct flashrom_layout **layout,
l->entries[l->num_entries].start = fmap->areas[i].offset;
l->entries[l->num_entries].end = fmap->areas[i].offset + fmap->areas[i].size - 1;
l->entries[l->num_entries].included = false;
memset(l->entries[l->num_entries].name, 0, sizeof(l->entries[i].name));
memcpy(l->entries[l->num_entries].name, fmap->areas[i].name,
min(FMAP_STRLEN, sizeof(l->entries[i].name)));
l->entries[l->num_entries].name =
strndup((const char *)fmap->areas[i].name, FMAP_STRLEN);
if (!l->entries[l->num_entries].name) {
msg_gerr("Error adding layout entry: %s\n", strerror(errno));
return 1;
}
msg_gdbg("fmap %08x - %08x named %s\n",
l->entries[l->num_entries].start,
l->entries[l->num_entries].end,