lib/edid.c: Dump EDID breakdown after null check

The edid variable was being dereferenced before the null check. Split
off the null check to before dumping and update the error message.

Fixes CID 1370576 (REVERSE_INULL)

Signed-off-by: Jacob Garber <jgarber1@ualberta.ca>
Change-Id: I8fe3d911df3a11a873056d3a5c05c5a3cbcfe2c0
Reviewed-on: https://review.coreboot.org/c/coreboot/+/32055
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
This commit is contained in:
Jacob Garber 2019-03-25 19:53:45 -06:00 committed by Patrick Georgi
parent 0fdc0b6b25
commit cd23f7f6c7
1 changed files with 8 additions and 3 deletions

View File

@ -1138,11 +1138,16 @@ int decode_edid(unsigned char *edid, int size, struct edid *out)
.conformant = EDID_CONFORMANT,
};
dump_breakdown(edid);
memset(out, 0, sizeof(*out));
if (!edid || memcmp(edid, "\x00\xFF\xFF\xFF\xFF\xFF\xFF\x00", 8)) {
if (!edid) {
printk(BIOS_SPEW, "No EDID found\n");
return EDID_ABSENT;
}
dump_breakdown(edid);
if (memcmp(edid, "\x00\xFF\xFF\xFF\xFF\xFF\xFF\x00", 8)) {
printk(BIOS_SPEW, "No header found\n");
return EDID_ABSENT;
}