Skip to content

Commit

Permalink
[PATCH] nv_i2c oops fix
Browse files Browse the repository at this point in the history
The call to fb_firmware_edid may return NULL but this is not checked before
trying to memcpy using this pointer.

Signed-off-by: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Antonino A. Daplas authored and Linus Torvalds committed Sep 14, 2005
1 parent 8fd9808 commit 0ed8e04
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions drivers/video/nvidia/nv_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,13 @@ int nvidia_probe_i2c_connector(struct fb_info *info, int conn, u8 **out_edid)

if (!edid && conn == 1) {
/* try to get from firmware */
edid = kmalloc(EDID_LENGTH, GFP_KERNEL);
if (edid)
memcpy(edid, fb_firmware_edid(info->device),
EDID_LENGTH);
const u8 *e = fb_firmware_edid(info->device);

if (e != NULL) {
edid = kmalloc(EDID_LENGTH, GFP_KERNEL);
if (edid)
memcpy(edid, e, EDID_LENGTH);
}
}

if (out_edid)
Expand Down

0 comments on commit 0ed8e04

Please sign in to comment.