Skip to content

Commit

Permalink
drm/crtc: Fix potential NULL pointer dereference
Browse files Browse the repository at this point in the history
drm_property_create_blob() could return NULL in which case NULL pointer
dereference error (on connector->edid_blob_ptr) is possible. Return if
connector->edid_blob_ptr is NULL.

Fixes the following smatch error:
drivers/gpu/drm/drm_crtc.c:3186 drm_mode_connector_update_edid_property()
error: potential null dereference 'connector->edid_blob_ptr'.
(drm_property_create_blob returns null)

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
  • Loading branch information
Sachin Kamat authored and Dave Airlie committed Nov 20, 2012
1 parent 9e1c156 commit e655d12
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/gpu/drm/drm_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3191,6 +3191,8 @@ int drm_mode_connector_update_edid_property(struct drm_connector *connector,
size = EDID_LENGTH * (1 + edid->extensions);
connector->edid_blob_ptr = drm_property_create_blob(connector->dev,
size, edid);
if (!connector->edid_blob_ptr)
return -EINVAL;

ret = drm_connector_property_set_value(connector,
dev->mode_config.edid_property,
Expand Down

0 comments on commit e655d12

Please sign in to comment.