diff options
author | David Hendricks <dhendrix@chromium.org> | 2015-08-13 15:51:00 -0700 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-08-28 06:42:14 +0000 |
commit | 40e89b4e5a04aa515bcfec896db4f8d29519d4f5 (patch) | |
tree | bdd2342a01b5847d704284931e8e1598805c5cd0 | |
parent | 7dbf9c6747ccdfa8b993d3843a22722742957611 (diff) |
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>
-rw-r--r-- | src/lib/edid.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/edid.c b/src/lib/edid.c index 22f3f0ead2..ed3565cb57 100644 --- a/src/lib/edid.c +++ b/src/lib/edid.c @@ -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; |