1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 15:12:36 +02:00

libflashrom.c: Fix unintialized value passed to function

In function flash_layout_read_from_ifd variable chip_layout remains
uninitialized if prepare_flash_access returns false. This uninitialized
variable (which contains a garbage value) is passed to
flashrom_layout_release. Thus initialize it with NULL. For completeness,
also initialize dump_layout with NULL.

Change-Id: Iacbd7bf9cdf897cc2a732c1dc6568845a4ab804d
Signed-off-by: Aarya Chaumal <aarya.chaumal@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/62725
Reviewed-by: Felix Singer <felixsinger@posteo.net>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
aarya 2022-03-10 08:47:48 +05:30 committed by Anastasia Klimchuk
parent 6b85eb87c6
commit 1b66464269

View File

@ -442,7 +442,7 @@ int flashrom_layout_read_from_ifd(struct flashrom_layout **const layout, struct
#ifndef __FLASHROM_LITTLE_ENDIAN__
return 6;
#else
struct flashrom_layout *dump_layout, *chip_layout;
struct flashrom_layout *dump_layout = NULL, *chip_layout = NULL;
int ret = 1;
void *const desc = malloc(0x1000);