[PATCH] nv_i2c oops fix

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>
This commit is contained in:
Antonino A. Daplas 2005-09-14 14:19:15 -07:00 committed by Linus Torvalds
parent 8fd9808aec
commit 0ed8e048c9

View File

@ -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)