AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/amdgpu: ensure the connector is not null before using it
@ 2024-08-09  7:34 Tim Huang
  2024-08-09  7:34 ` [PATCH 2/2] drm/amd/pm: ensure the fw_info " Tim Huang
  2024-08-14  8:59 ` [PATCH 1/2] drm/amdgpu: ensure the connector " Zhang, Jesse(Jie)
  0 siblings, 2 replies; 4+ messages in thread
From: Tim Huang @ 2024-08-09  7:34 UTC (permalink / raw)
  To: amd-gfx
  Cc: alexander.deucher, christian.koenig, jesse.zhang, bob.zhou,
	Tim Huang

This resolves the dereference null return value warning
reported by Coverity.

Signed-off-by: Tim Huang <tim.huang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 092ec11258cd..046d4c4e0299 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -1474,7 +1474,7 @@ bool amdgpu_display_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
 		if ((!(mode->flags & DRM_MODE_FLAG_INTERLACE)) &&
 		    ((amdgpu_encoder->underscan_type == UNDERSCAN_ON) ||
 		     ((amdgpu_encoder->underscan_type == UNDERSCAN_AUTO) &&
-		      connector->display_info.is_hdmi &&
+		      connector && connector->display_info.is_hdmi &&
 		      amdgpu_display_is_hdtv_mode(mode)))) {
 			if (amdgpu_encoder->underscan_hborder != 0)
 				amdgpu_crtc->h_border = amdgpu_encoder->underscan_hborder;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] drm/amd/pm: ensure the fw_info is not null before using it
  2024-08-09  7:34 [PATCH 1/2] drm/amdgpu: ensure the connector is not null before using it Tim Huang
@ 2024-08-09  7:34 ` Tim Huang
  2024-08-14  8:59   ` Zhang, Jesse(Jie)
  2024-08-14  8:59 ` [PATCH 1/2] drm/amdgpu: ensure the connector " Zhang, Jesse(Jie)
  1 sibling, 1 reply; 4+ messages in thread
From: Tim Huang @ 2024-08-09  7:34 UTC (permalink / raw)
  To: amd-gfx
  Cc: alexander.deucher, christian.koenig, jesse.zhang, bob.zhou,
	Tim Huang

This resolves the dereference null return value warning
reported by Coverity.

Signed-off-by: Tim Huang <tim.huang@amd.com>
---
 drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c
index ca1c7ae8d146..f06b29e33ba4 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c
@@ -1183,6 +1183,8 @@ static int init_overdrive_limits(struct pp_hwmgr *hwmgr,
 	fw_info = smu_atom_get_data_table(hwmgr->adev,
 			 GetIndexIntoMasterTable(DATA, FirmwareInfo),
 			 &size, &frev, &crev);
+	PP_ASSERT_WITH_CODE(fw_info != NULL,
+			    "Missing firmware info!", return -EINVAL);
 
 	if ((fw_info->ucTableFormatRevision == 1)
 	    && (le16_to_cpu(fw_info->usStructureSize) >= sizeof(ATOM_FIRMWARE_INFO_V1_4)))
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH 2/2] drm/amd/pm: ensure the fw_info is not null before using it
  2024-08-09  7:34 ` [PATCH 2/2] drm/amd/pm: ensure the fw_info " Tim Huang
@ 2024-08-14  8:59   ` Zhang, Jesse(Jie)
  0 siblings, 0 replies; 4+ messages in thread
From: Zhang, Jesse(Jie) @ 2024-08-14  8:59 UTC (permalink / raw)
  To: Huang, Tim, amd-gfx@lists.freedesktop.org
  Cc: Deucher, Alexander, Koenig, Christian, Zhou, Bob

[AMD Official Use Only - AMD Internal Distribution Only]

This patch is
Reviewed-by: Jesse Zhang <jesse.zhang@amd.com>
-----Original Message-----
From: Huang, Tim <Tim.Huang@amd.com>
Sent: Friday, August 9, 2024 3:34 PM
To: amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Zhang, Jesse(Jie) <Jesse.Zhang@amd.com>; Zhou, Bob <Bob.Zhou@amd.com>; Huang, Tim <Tim.Huang@amd.com>
Subject: [PATCH 2/2] drm/amd/pm: ensure the fw_info is not null before using it

This resolves the dereference null return value warning reported by Coverity.

Signed-off-by: Tim Huang <tim.huang@amd.com>
---
 drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c
index ca1c7ae8d146..f06b29e33ba4 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c
@@ -1183,6 +1183,8 @@ static int init_overdrive_limits(struct pp_hwmgr *hwmgr,
        fw_info = smu_atom_get_data_table(hwmgr->adev,
                         GetIndexIntoMasterTable(DATA, FirmwareInfo),
                         &size, &frev, &crev);
+       PP_ASSERT_WITH_CODE(fw_info != NULL,
+                           "Missing firmware info!", return -EINVAL);

        if ((fw_info->ucTableFormatRevision == 1)
            && (le16_to_cpu(fw_info->usStructureSize) >= sizeof(ATOM_FIRMWARE_INFO_V1_4)))
--
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH 1/2] drm/amdgpu: ensure the connector is not null before using it
  2024-08-09  7:34 [PATCH 1/2] drm/amdgpu: ensure the connector is not null before using it Tim Huang
  2024-08-09  7:34 ` [PATCH 2/2] drm/amd/pm: ensure the fw_info " Tim Huang
@ 2024-08-14  8:59 ` Zhang, Jesse(Jie)
  1 sibling, 0 replies; 4+ messages in thread
From: Zhang, Jesse(Jie) @ 2024-08-14  8:59 UTC (permalink / raw)
  To: Huang, Tim, amd-gfx@lists.freedesktop.org
  Cc: Deucher, Alexander, Koenig, Christian, Zhou, Bob

[AMD Official Use Only - AMD Internal Distribution Only]

This patch is
Reviewed-by: Jesse Zhang <jesse.zhang@amd.com>

-----Original Message-----
From: Huang, Tim <Tim.Huang@amd.com>
Sent: Friday, August 9, 2024 3:34 PM
To: amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Zhang, Jesse(Jie) <Jesse.Zhang@amd.com>; Zhou, Bob <Bob.Zhou@amd.com>; Huang, Tim <Tim.Huang@amd.com>
Subject: [PATCH 1/2] drm/amdgpu: ensure the connector is not null before using it

This resolves the dereference null return value warning reported by Coverity.

Signed-off-by: Tim Huang <tim.huang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 092ec11258cd..046d4c4e0299 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -1474,7 +1474,7 @@ bool amdgpu_display_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
                if ((!(mode->flags & DRM_MODE_FLAG_INTERLACE)) &&
                    ((amdgpu_encoder->underscan_type == UNDERSCAN_ON) ||
                     ((amdgpu_encoder->underscan_type == UNDERSCAN_AUTO) &&
-                     connector->display_info.is_hdmi &&
+                     connector && connector->display_info.is_hdmi &&
                      amdgpu_display_is_hdtv_mode(mode)))) {
                        if (amdgpu_encoder->underscan_hborder != 0)
                                amdgpu_crtc->h_border = amdgpu_encoder->underscan_hborder;
--
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-08-14  8:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-09  7:34 [PATCH 1/2] drm/amdgpu: ensure the connector is not null before using it Tim Huang
2024-08-09  7:34 ` [PATCH 2/2] drm/amd/pm: ensure the fw_info " Tim Huang
2024-08-14  8:59   ` Zhang, Jesse(Jie)
2024-08-14  8:59 ` [PATCH 1/2] drm/amdgpu: ensure the connector " Zhang, Jesse(Jie)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox