edid: Memset output earlier in decode_edid()

This ensures the output buffer is initialized before exiting
decode_edid() so that if the return value is ignored in higher-level
logic (like when dealing with external displays) we don't leave
the struct filled with garbage.

BUG=chrome-os-partner:42946
BRANCH=firmware-veyron
TEST=none

Change-Id: I557e2495157458342db6d8b0b1ecb39f7267f61f
Signed-off-by: Patrick Georgi <patrick@georgi-clan.de>
Original-Commit-Id: bb12dca133576543efa4d3bcc9aadf85d37c8b71
Original-Change-Id: I697436fffadc7dd3af239436061975165a97ec8c
Original-Signed-off-by: David Hendricks <dhendrix@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/293547
Original-Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: http://review.coreboot.org/11389
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
David Hendricks 2015-08-13 15:51:00 -07:00 committed by Patrick Georgi
parent 7dbf9c6747
commit 40e89b4e5a
1 changed files with 2 additions and 1 deletions

View File

@ -1001,12 +1001,13 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
dump_breakdown(edid);
memset(out, 0, sizeof(*out));
if (!edid || memcmp(edid, "\x00\xFF\xFF\xFF\xFF\xFF\xFF\x00", 8)) {
printk(BIOS_SPEW, "No header found\n");
return 1;
}
memset(out, 0, sizeof(*out));
if (manufacturer_name(edid + 0x08))
c.manufacturer_name_well_formed = 1;