diff options
author | Asami Doi <d0iasm.pub@gmail.com> | 2019-07-24 16:04:20 +0900 |
---|---|---|
committer | Julius Werner <jwerner@chromium.org> | 2019-08-06 20:29:57 +0000 |
commit | 02547c58869eed2295853ad12618285d45fca7da (patch) | |
tree | 6bda4b43148a32471bfa534b152b2621cace9a3e | |
parent | b8f1bd7a378dbc1fa5adfd557292aef10f8f310e (diff) | |
download | coreboot-02547c58869eed2295853ad12618285d45fca7da.tar.xz |
lib: Throw an error when ramdisk is present but initrd.size is 0
It fails if you call extract() when ramdisk is present but initrd
size is 0. This CL adds if-statement to throw an error when initrd
size is 0.
Change-Id: I85aa33d2c2846b6b3a58df834dda18c47433257d
Signed-off-by: Asami Doi <d0iasm.pub@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34535
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Reviewed-by: Martin Roth <martinroth@google.com>
-rw-r--r-- | src/lib/fit_payload.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/lib/fit_payload.c b/src/lib/fit_payload.c index a4d370540e..1b6c9860f0 100644 --- a/src/lib/fit_payload.c +++ b/src/lib/fit_payload.c @@ -51,6 +51,11 @@ static bool extract(struct region *region, struct fit_image_node *node) const char *comp_name; size_t true_size = 0; + if (node->size == 0) { + printk(BIOS_ERR, "ERROR: The %s size is 0\n", node->name); + return true; + } + switch (node->compression) { case CBFS_COMPRESS_NONE: comp_name = "Relocating uncompressed"; |