Commit e655d122 authored by Sachin Kamat's avatar Sachin Kamat Committed by Dave Airlie

drm/crtc: Fix potential NULL pointer dereference

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: default avatarSachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 9e1c156f
...@@ -3191,6 +3191,8 @@ int drm_mode_connector_update_edid_property(struct drm_connector *connector, ...@@ -3191,6 +3191,8 @@ int drm_mode_connector_update_edid_property(struct drm_connector *connector,
size = EDID_LENGTH * (1 + edid->extensions); size = EDID_LENGTH * (1 + edid->extensions);
connector->edid_blob_ptr = drm_property_create_blob(connector->dev, connector->edid_blob_ptr = drm_property_create_blob(connector->dev,
size, edid); size, edid);
if (!connector->edid_blob_ptr)
return -EINVAL;
ret = drm_connector_property_set_value(connector, ret = drm_connector_property_set_value(connector,
dev->mode_config.edid_property, dev->mode_config.edid_property,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment