Skip to content

Commit

Permalink
viafb: NULL dereference on allocation failure in query_edid()
Browse files Browse the repository at this point in the history
We should handle the allocation here, if only to keep the static
checkers happy.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
  • Loading branch information
Dan Carpenter authored and Florian Tobias Schandinat committed Feb 17, 2012
1 parent 7b91812 commit c572c8b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/video/via/via_aux_edid.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@ static void query_edid(struct via_aux_drv *drv)
unsigned char edid[EDID_LENGTH];
bool valid = false;

if (spec)
if (spec) {
fb_destroy_modedb(spec->modedb);
else
} else {
spec = kmalloc(sizeof(*spec), GFP_KERNEL);
if (!spec)
return;
}

spec->version = spec->revision = 0;
if (via_aux_read(drv, 0x00, edid, EDID_LENGTH)) {
Expand Down

0 comments on commit c572c8b

Please sign in to comment.