Skip to contentSkip to conversation

drm/admgpu: fix the page fault caused by uninitialized variables

PATCH In review Xiaojian Du 3 participants 3 messages Jan 20, 2022

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

PATCH 1/1 drm/admgpu: fix the page fault caused by uninitialized variables

This patch will fix the page fault caused by uninitialized variables.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +3 -3
index c65d82301bca..09780a0f874a 100644
@@ -828,9 +828,9 @@ void amdgpu_gmc_get_reserved_allocation(struct amdgpu_device *adev)
 
 int amdgpu_gmc_vram_checking(struct amdgpu_device *adev)
 {
-	struct amdgpu_bo *vram_bo;
-	uint64_t vram_gpu;
-	void *vram_ptr;
+	struct amdgpu_bo *vram_bo = NULL;
+	uint64_t vram_gpu = 0;
+	void *vram_ptr = NULL;
 
 	int ret, size = 0x100000;
 	uint8_t cptr[10];
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only]

Best Regards,
Kevin
________________________________
From: amd-gfx <[email protected]> on behalf of Xiaojian Du <[email protected]>
Sent: Thursday, January 20, 2022 4:02 PM
To: [email protected] <[email protected]>
Cc: Huang, Ray <[email protected]>; Du, Xiaojian <[email protected]>
Subject: [PATCH] drm/admgpu: fix the page fault caused by uninitialized variables

This patch will fix the page fault caused by uninitialized variables.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +3 -3
index c65d82301bca..09780a0f874a 100644
@@ -828,9 +828,9 @@ void amdgpu_gmc_get_reserved_allocation(struct amdgpu_device *adev)
 
 int amdgpu_gmc_vram_checking(struct amdgpu_device *adev)
 {
-       struct amdgpu_bo *vram_bo;
-       uint64_t vram_gpu;
-       void *vram_ptr;
+       struct amdgpu_bo *vram_bo = NULL;
+       uint64_t vram_gpu = 0;
+       void *vram_ptr = NULL;
 
         int ret, size = 0x100000;
         uint8_t cptr[10];

--
2.17.1

#2 lore raw
In reply to Xiaojian Du

[Public]

If you add the page fault info in your commit message, that's better.

Regards,
Guchun

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Xiaojian Du
Sent: Thursday, January 20, 2022 4:02 PM
To: [email protected]
Cc: Huang, Ray <[email protected]>; Du, Xiaojian <[email protected]>
Subject: [PATCH] drm/admgpu: fix the page fault caused by uninitialized variables

This patch will fix the page fault caused by uninitialized variables.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +3 -4
index c65d82301bca..09780a0f874a 100644
@@ -828,9 +828,9 @@ void amdgpu_gmc_get_reserved_allocation(struct amdgpu_device *adev)
 
 int amdgpu_gmc_vram_checking(struct amdgpu_device *adev)  {
-	struct amdgpu_bo *vram_bo;
-	uint64_t vram_gpu;
-	void *vram_ptr;
+	struct amdgpu_bo *vram_bo = NULL;
+	uint64_t vram_gpu = 0;
+	void *vram_ptr = NULL;
 
 	int ret, size = 0x100000;
 	uint8_t cptr[10];
--

2.17.1