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>
This commit is contained in:
parent
b8f1bd7a37
commit
02547c5886
|
@ -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";
|
||||
|
|
Loading…
Reference in New Issue