Commit 3222a811 authored by Haowen Bai's avatar Haowen Bai Committed by Alex Deucher

drm/amd/display: Fix pointer dereferenced before checking

The pointer edid_buf is dereferencing pointer edid before edid is being
 null checked. Fix this by assigning edid->raw_edid to edid_buf only if
edid is not NULL, otherwise just NULL.
Signed-off-by: default avatarHaowen Bai <baihaowen@meizu.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent c4af42b4
...@@ -90,7 +90,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps( ...@@ -90,7 +90,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps(
{ {
struct amdgpu_dm_connector *aconnector = link->priv; struct amdgpu_dm_connector *aconnector = link->priv;
struct drm_connector *connector = &aconnector->base; struct drm_connector *connector = &aconnector->base;
struct edid *edid_buf = (struct edid *) edid->raw_edid; struct edid *edid_buf = edid ? (struct edid *) edid->raw_edid : NULL;
struct cea_sad *sads; struct cea_sad *sads;
int sad_count = -1; int sad_count = -1;
int sadb_count = -1; int sadb_count = -1;
......
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