diff options
author | Marcin Slusarz <marcin.slusarz@gmail.com> | 2013-01-27 20:04:48 +0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2013-02-20 10:00:39 +0400 |
commit | a441dbb1d674b5696e3a27a95e72988f35236c9f (patch) | |
tree | fcbd0c87cca58162725bb3e461f3c0f6b558f600 /drivers/gpu/drm/nouveau/nouveau_connector.c | |
parent | 03e9a04050f5333c779ed37c027a6aae5644cf6c (diff) | |
download | linux-a441dbb1d674b5696e3a27a95e72988f35236c9f.tar.xz |
drm/nouveau: use kmemdup for edid allocation/copying
Avoids potential null pointer dereference.
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_connector.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_connector.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index e620ba8271b4..2f3e40ec86a0 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -399,9 +399,10 @@ nouveau_connector_detect_lvds(struct drm_connector *connector, bool force) struct edid *edid = (struct edid *)nouveau_bios_embedded_edid(dev); if (edid) { - nv_connector->edid = kmalloc(EDID_LENGTH, GFP_KERNEL); - *(nv_connector->edid) = *edid; - status = connector_status_connected; + nv_connector->edid = + kmemdup(edid, EDID_LENGTH, GFP_KERNEL); + if (nv_connector->edid) + status = connector_status_connected; } } |