Skip to contentSkip to conversation

drm/amd/powerplay: implement smu7 hwmgr to manager asics with smu ip version 7.

bug report Dan Carpenter 3 participants 3 messages Oct 12, 2016 – Oct 13, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello Rex Zhu,

This is a semi-automatic email about new static checker warnings.

The patch 599a7e9fe1b6: "drm/amd/powerplay: implement smu7 hwmgr to manager asics with smu ip version 7." from Sep 9, 2016, leads to the following Smatch complaint:

drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/smu7_hwmgr.c:1463 smu7_get_evv_voltages()
error: we previously assumed 'table_info' could be null (see line 1455)

drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/smu7_hwmgr.c
1454
1455 if (table_info != NULL)

                     ^^^^^^^^^^^^^^^^^

Check for non-NULL.

1456 sclk_table = table_info->vdd_dep_on_sclk;
1457
1458 for (i = 0; i < SMU7_MAX_LEAKAGE_COUNT; i++) {
1459 vv_id = ATOM_VIRTUAL_VOLTAGE_ID0 + i;
1460
1461 if (data->vdd_gfx_control == SMU7_VOLTAGE_CONTROL_BY_SVID2) {
1462 if (0 == phm_get_sclk_for_voltage_evv(hwmgr,

  1463							table_info->vddgfx_lookup_table, vv_id, &sclk)) {
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Unchecked dereference.

  1464					if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
  1465								PHM_PlatformCaps_ClockStretcher)) {

regards,
dan carpenter
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw

Please Review.

Best Regards
Rex

-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Wednesday, October 12, 2016 2:12 PM
To: Zhu, Rex
Cc: [email protected]
Subject: [bug report] drm/amd/powerplay: implement smu7 hwmgr to manager asics with smu ip version 7.

Hello Rex Zhu,

This is a semi-automatic email about new static checker warnings.

The patch 599a7e9fe1b6: "drm/amd/powerplay: implement smu7 hwmgr to manager asics with smu ip version 7." from Sep 9, 2016, leads to the following Smatch complaint:

drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/smu7_hwmgr.c:1463 smu7_get_evv_voltages()
error: we previously assumed 'table_info' could be null (see line 1455)

drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/smu7_hwmgr.c
1454
1455 if (table_info != NULL)

                     ^^^^^^^^^^^^^^^^^

Check for non-NULL.

  1456			sclk_table = table_info->vdd_dep_on_sclk;
  1457	
  1458		for (i = 0; i < SMU7_MAX_LEAKAGE_COUNT; i++) {
  1459			vv_id = ATOM_VIRTUAL_VOLTAGE_ID0 + i;
  1460	
  1461			if (data->vdd_gfx_control == SMU7_VOLTAGE_CONTROL_BY_SVID2) {
  1462				if (0 == phm_get_sclk_for_voltage_evv(hwmgr,
  1463							table_info->vddgfx_lookup_table, vv_id, &sclk)) {
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Unchecked dereference.

  1464					if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
  1465								PHM_PlatformCaps_ClockStretcher)) {

regards,
dan carpenter

From 77a2ee4069658df398534eb669a31ace444f0955 Mon Sep 17 00:00:00 2001
From: Rex Zhu <[email protected]>
Date: Thu, 13 Oct 2016 15:32:04 +0800
Subject: [PATCH] drm/amd/powerplay: fix static checker warnings in
smu7_hwmgr.c

Change-Id Icefccdecd7a2434047389e4766e69077647d206f
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +4 -2
index 49f35c7..ca0413a 100644
@@ -1474,8 +1474,10 @@ static int smu7_get_evv_voltages(struct pp_hwmgr *hwmgr)
 	struct phm_ppt_v1_clock_voltage_dependency_table *sclk_table = NULL;
 
 
-	if (table_info != NULL)
-		sclk_table = table_info->vdd_dep_on_sclk;
+	if (table_info == NULL)
+		return -EINVAL;
+
+	sclk_table = table_info->vdd_dep_on_sclk;
 
 	for (i = 0; i < SMU7_MAX_LEAKAGE_COUNT; i++) {
 		vv_id = ATOM_VIRTUAL_VOLTAGE_ID0 + i;
Signature · 1 line
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw

Patch is Reviewed-by: Christian König <[email protected]>.

Regards,
Christian.

Am 13.10.2016 um 09:43 schrieb Zhu, Rex:

Quoted 40 lines

Please Review.

Best Regards
Rex

-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Wednesday, October 12, 2016 2:12 PM
To: Zhu, Rex
Cc: [email protected]
Subject: [bug report] drm/amd/powerplay: implement smu7 hwmgr to manager asics with smu ip version 7.

Hello Rex Zhu,

This is a semi-automatic email about new static checker warnings.

The patch 599a7e9fe1b6: "drm/amd/powerplay: implement smu7 hwmgr to manager asics with smu ip version 7." from Sep 9, 2016, leads to the following Smatch complaint:

drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/smu7_hwmgr.c:1463 smu7_get_evv_voltages()
error: we previously assumed 'table_info' could be null (see line 1455)

drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/smu7_hwmgr.c
1454
1455 if (table_info != NULL)

                      ^^^^^^^^^^^^^^^^^

Check for non-NULL.

   1456			sclk_table = table_info->vdd_dep_on_sclk;
   1457	
   1458		for (i = 0; i < SMU7_MAX_LEAKAGE_COUNT; i++) {
   1459			vv_id = ATOM_VIRTUAL_VOLTAGE_ID0 + i;
   1460	
   1461			if (data->vdd_gfx_control == SMU7_VOLTAGE_CONTROL_BY_SVID2) {
   1462				if (0 == phm_get_sclk_for_voltage_evv(hwmgr,
   1463							table_info->vddgfx_lookup_table, vv_id, &sclk)) {
                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Unchecked dereference.

   1464					if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
   1465								PHM_PlatformCaps_ClockStretcher)) {
Quoted 8 lines

regards,
dan carpenter

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel