Skip to contentSkip to conversation

drm/amdgpu: fix NULL err for sriov detect

PATCH In review Chunming Zhou 2 participants 2 messages Dec 13, 2017 1 message not in the archive

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

PATCH 1/1 drm/amdgpu: fix NULL err for sriov detect

[   21.841536] BUG: KASAN: null-ptr-deref in soc15_set_ip_blocks+0x4f/0x2e0 [amdgpu]
Change-Id I182dfed95c362123a75feafe44fa2ad3f3f35cac
---
 drivers/gpu/drm/amd/amdgpu/soc15.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/soc15.c +5 -5
index a16e8d9a8fa2..49ff552cd6fe 100644
@@ -521,6 +521,11 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev)
 		return -EINVAL;
 	}
 
+	if (adev->flags & AMD_IS_APU)
+		adev->nbio_funcs = &nbio_v7_0_funcs;
+	else
+		adev->nbio_funcs = &nbio_v6_1_funcs;
+
 	adev->nbio_funcs->detect_hw_virt(adev);
 
 	if (amdgpu_sriov_vf(adev))
@@ -611,11 +616,6 @@ static int soc15_common_early_init(void *handle)
 
 	adev->asic_funcs = &soc15_asic_funcs;
 
-	if (adev->flags & AMD_IS_APU)
-		adev->nbio_funcs = &nbio_v7_0_funcs;
-	else
-		adev->nbio_funcs = &nbio_v6_1_funcs;
-
 	if (amdgpu_get_ip_block(adev, AMD_IP_BLOCK_TYPE_PSP) &&
 		(amdgpu_ip_block_mask & (1 << AMD_IP_BLOCK_TYPE_PSP)))
 		psp_enabled = true;
Signature · 6 lines
2.14.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by
#2 lore raw
In reply to a message not in the archive

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Chunming Zhou <[email protected]>
Sent: Wednesday, December 13, 2017 4:03 AM
To: [email protected]
Cc: Zhou, David(ChunMing); Liu, Monk
Subject: [PATCH] drm/amdgpu: fix NULL err for sriov detect

[   21.841536] BUG: KASAN: null-ptr-deref in soc15_set_ip_blocks+0x4f/0x2e0 [amdgpu]
Change-Id I182dfed95c362123a75feafe44fa2ad3f3f35cac
---
 drivers/gpu/drm/amd/amdgpu/soc15.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/soc15.c +5 -5
index a16e8d9a8fa2..49ff552cd6fe 100644
@@ -521,6 +521,11 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev)
                 return -EINVAL;
         }
 
+       if (adev->flags & AMD_IS_APU)
+               adev->nbio_funcs = &nbio_v7_0_funcs;
+       else
+               adev->nbio_funcs = &nbio_v6_1_funcs;
+
         adev->nbio_funcs->detect_hw_virt(adev);
 
         if (amdgpu_sriov_vf(adev))
@@ -611,11 +616,6 @@ static int soc15_common_early_init(void *handle)
 
         adev->asic_funcs = &soc15_asic_funcs;
 
-       if (adev->flags & AMD_IS_APU)
-               adev->nbio_funcs = &nbio_v7_0_funcs;
-       else
-               adev->nbio_funcs = &nbio_v6_1_funcs;
-
         if (amdgpu_get_ip_block(adev, AMD_IP_BLOCK_TYPE_PSP) &&
                 (amdgpu_ip_block_mask & (1 << AMD_IP_BLOCK_TYPE_PSP)))
                 psp_enabled = true;

--
2.14.1

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

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