Skip to content

Commit

Permalink
video: fbdev: fix possible null dereference
Browse files Browse the repository at this point in the history
we were dereferencing edid first and the NULL check was after
accessing that. now we are using edid only if we know that
it is not NULL.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
  • Loading branch information
Sudip Mukherjee authored and Tomi Valkeinen committed Feb 26, 2015
1 parent 11f09e5 commit d746b40
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/video/fbdev/core/fbmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,9 +624,6 @@ static struct fb_videomode *fb_create_modedb(unsigned char *edid, int *dbsize,
int num = 0, i, first = 1;
int ver, rev;

ver = edid[EDID_STRUCT_VERSION];
rev = edid[EDID_STRUCT_REVISION];

mode = kzalloc(50 * sizeof(struct fb_videomode), GFP_KERNEL);
if (mode == NULL)
return NULL;
Expand All @@ -637,6 +634,9 @@ static struct fb_videomode *fb_create_modedb(unsigned char *edid, int *dbsize,
return NULL;
}

ver = edid[EDID_STRUCT_VERSION];
rev = edid[EDID_STRUCT_REVISION];

*dbsize = 0;

DPRINTK(" Detailed Timings\n");
Expand Down

0 comments on commit d746b40

Please sign in to comment.