Skip to contentSkip to conversation

drm/amdgpu/soc15: fix nullptr issue in soc15_read_register() for reg base accessing

PATCH In review Prike.Liang 2 participants 2 messages Jun 8, 2020

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

PATCH 1/1 drm/amdgpu/soc15: fix nullptr issue in soc15_read_register() for reg base accessing

The failed case is no SDMA1 IP for Renoir discovery table while in accessing SDMA1 reg base, thus need have nullptr test for soc15_read_register invoked in MMR addres space inqure opt.

---
 drivers/gpu/drm/amd/amdgpu/soc15.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/soc15.c +2 -1
index 623745b..3e406ee 100644
@@ -415,7 +415,8 @@ static int soc15_read_register(struct amdgpu_device *adev, u32 se_num,
 	*value = 0;
 	for (i = 0; i < ARRAY_SIZE(soc15_allowed_read_registers); i++) {
 		en = &soc15_allowed_read_registers[i];
-		if (reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg]
+		if (adev->reg_offset[en->hwip][en->inst] &&
+			reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg]
 					+ en->reg_offset))
 			continue;
 
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
maintainer Reviewed-by on v1 1/1
#1 lore raw

[AMD Public Use]

________________________________
From: Liang, Prike <[email protected]>
Sent: Monday, June 8, 2020 3:34 AM
To: [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH] drm/amdgpu/soc15: fix nullptr issue in soc15_read_register() for reg base accessing

The failed case is no SDMA1 IP for Renoir discovery table while in accessing SDMA1 reg base, thus need have nullptr test for soc15_read_register invoked in MMR addres space inqure opt.

---
 drivers/gpu/drm/amd/amdgpu/soc15.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/soc15.c +2 -1
index 623745b..3e406ee 100644
@@ -415,7 +415,8 @@ static int soc15_read_register(struct amdgpu_device *adev, u32 se_num,
         *value = 0;
         for (i = 0; i < ARRAY_SIZE(soc15_allowed_read_registers); i++) {
                 en = &soc15_allowed_read_registers[i];
-               if (reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg]
+               if (adev->reg_offset[en->hwip][en->inst] &&
+                       reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg]
                                         + en->reg_offset))
                         continue;
 

--
2.7.4

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