diff options
author | Nico Huber <nico.h@gmx.de> | 2019-06-15 14:56:19 +0200 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2019-06-17 08:32:43 +0000 |
commit | 70461a9524fc84ec5c095f11927cffa0429a6267 (patch) | |
tree | 0df6b67aec1d936bf8b39a86d5d9ed97ef5aa125 /ich_descriptors.c | |
parent | 4f213285d78974c4b8915b311aff88449279f554 (diff) | |
download | flashrom-70461a9524fc84ec5c095f11927cffa0429a6267.tar.gz flashrom-70461a9524fc84ec5c095f11927cffa0429a6267.tar.bz2 flashrom-70461a9524fc84ec5c095f11927cffa0429a6267.zip |
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>
Diffstat (limited to 'ich_descriptors.c')
-rw-r--r-- | ich_descriptors.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ich_descriptors.c b/ich_descriptors.c index 251f6369f..0a4cf75ee 100644 --- a/ich_descriptors.c +++ b/ich_descriptors.c @@ -1153,7 +1153,8 @@ int read_ich_descriptors_via_fdo(enum ich_chipset cs, void *spibar, struct ich_d * @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 @@ int layout_from_ich_descriptors(struct ich_layout *const layout, const void *con 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; |