Skip to content

Commit 978ffac

Browse files
JoseExpositoalexdeucher
authored andcommitted
drm/amd/display: invalid parameter check in dmub_hpd_callback
The function performs a check on the "adev" input parameter, however, it is used before the check. Initialize the "dev" variable after the sanity check to avoid a possible NULL pointer dereference. Fixes: e27c41d ("drm/amd/display: Support for DMUB HPD interrupt handling") Addresses-Coverity-ID: 1493909 ("Null pointer dereference") Reviewed-by: Harry Wentland <[email protected]> Signed-off-by: José Expósito <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 8b5da5a commit 978ffac

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ static void dmub_hpd_callback(struct amdgpu_device *adev,
658658
struct drm_connector_list_iter iter;
659659
struct dc_link *link;
660660
uint8_t link_index = 0;
661-
struct drm_device *dev = adev->dm.ddev;
661+
struct drm_device *dev;
662662

663663
if (adev == NULL)
664664
return;
@@ -675,6 +675,7 @@ static void dmub_hpd_callback(struct amdgpu_device *adev,
675675

676676
link_index = notify->link_index;
677677
link = adev->dm.dc->links[link_index];
678+
dev = adev->dm.ddev;
678679

679680
drm_connector_list_iter_begin(dev, &iter);
680681
drm_for_each_connector_iter(connector, &iter) {

0 commit comments

Comments
 (0)