Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ed8e048 authored by Antonino A. Daplas's avatar Antonino A. Daplas Committed by Linus Torvalds
Browse files

[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: default avatarAntonino Daplas <adaplas@pol.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8fd9808a
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -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 */
		const u8 *e = fb_firmware_edid(info->device);

		if (e != NULL) {
			edid = kmalloc(EDID_LENGTH, GFP_KERNEL);
			if (edid)
			memcpy(edid, fb_firmware_edid(info->device),
			       EDID_LENGTH);
				memcpy(edid, e, EDID_LENGTH);
		}
	}

	if (out_edid)