From: Antonino A. Daplas Date: Wed, 14 Sep 2005 21:19:15 +0000 (-0700) Subject: [PATCH] nv_i2c oops fix X-Git-Tag: v2.6.14-rc2~29 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=0ed8e048c9e11e69ec951f94066105e80cdc59fd;p=linux-2.6-omap-h63xx.git [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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/video/nvidia/nv_i2c.c b/drivers/video/nvidia/nv_i2c.c index ace484fa61c..12f2884d3f0 100644 --- a/drivers/video/nvidia/nv_i2c.c +++ b/drivers/video/nvidia/nv_i2c.c @@ -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)