[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1648114034-3802-1-git-send-email-baihaowen@meizu.com>
Date: Thu, 24 Mar 2022 17:27:14 +0800
From: Haowen Bai <baihaowen@...zu.com>
To: <harry.wentland@....com>, <sunpeng.li@....com>,
<Rodrigo.Siqueira@....com>, <alexander.deucher@....com>,
<christian.koenig@....com>, <Xinhui.Pan@....com>,
<airlied@...ux.ie>, <daniel@...ll.ch>,
<nicholas.kazlauskas@....com>, <lyude@...hat.com>,
<Jerry.Zuo@....com>
CC: <amd-gfx@...ts.freedesktop.org>, <dri-devel@...ts.freedesktop.org>,
<linux-kernel@...r.kernel.org>, Haowen Bai <baihaowen@...zu.com>
Subject: [PATCH] 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: Haowen Bai <baihaowen@...zu.com>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
index 29f07c2..360401d 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
@@ -89,7 +89,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps(
{
struct amdgpu_dm_connector *aconnector = link->priv;
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;
int sad_count = -1;
int sadb_count = -1;
--
2.7.4
Powered by blists - more mailing lists