Skip to contentSkip to conversation

drm/amdgpu: fix uninitialized variable pasid_mapping_needed

PATCH Applied Colin King 3 participants 3 messages Oct 3, 2019 – Oct 4, 2019

Subsystems (3)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 drm/amdgpu: fix uninitialized variable pasid_mapping_needed

From: Colin Ian King <[email protected]>

The boolean variable pasid_mapping_needed is not initialized and there are code paths that do not assign it any value before it is is read later. Fix this by initializing pasid_mapping_needed to false.

Addresses-Coverity: ("Uninitialized scalar variable")

Fixes 6817bf283b2b ("drm/amdgpu: grab the id mgr lock while accessing passid_mapping")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
index a2c797e34a29..be10e4b9a94d 100644
@@ -1055,7 +1055,7 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job,
 		id->oa_size != job->oa_size);
 	bool vm_flush_needed = job->vm_needs_flush;
 	struct dma_fence *fence = NULL;
-	bool pasid_mapping_needed;
+	bool pasid_mapping_needed = false;
 	unsigned patch_offset = 0;
 	int r;
 
Signature · 1 line
2.20.1
maintainer Reviewed-by on v1 1/1
#1 lore raw

Am 03.10.19 um 23:52 schrieb Colin King:

Quoted 10 lines

From: Colin Ian King <[email protected]>

The boolean variable pasid_mapping_needed is not initialized and there are code paths that do not assign it any value before it is is read later. Fix this by initializing pasid_mapping_needed to false.

Addresses-Coverity: ("Uninitialized scalar variable")

Fixes 6817bf283b2b ("drm/amdgpu: grab the id mgr lock while accessing passid_mapping")
Quoted 9 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index a2c797e34a29..be10e4b9a94d 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, · line 1061

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
@@ -1055,7 +1055,7 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job,
  		id->oa_size != job->oa_size);
  	bool vm_flush_needed = job->vm_needs_flush;
  	struct dma_fence *fence = NULL;
-	bool pasid_mapping_needed;
+	bool pasid_mapping_needed = false;
  	unsigned patch_offset = 0;
  	int r;
 

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

Applied
#2 lore raw
Quoted 9 lines · Christian

Am 03.10.19 um 23:52 schrieb Colin King:

Quoted 7 lines

From: Colin Ian King <[email protected]>

The boolean variable pasid_mapping_needed is not initialized and there are code paths that do not assign it any value before it is is read later. Fix this by initializing pasid_mapping_needed to false.

Quoted 6 lines
Quoted 3 lines

Addresses-Coverity: ("Uninitialized scalar variable")

Fixes 6817bf283b2b ("drm/amdgpu: grab the id mgr lock while accessing passid_mapping")

Applied. thanks!

Alex

Quoted 22 lines
Quoted 9 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index a2c797e34a29..be10e4b9a94d 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, · line 1061

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
@@ -1055,7 +1055,7 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job,
              id->oa_size != job->oa_size);
      bool vm_flush_needed = job->vm_needs_flush;
      struct dma_fence *fence = NULL;
-     bool pasid_mapping_needed;
+     bool pasid_mapping_needed = false;
      unsigned patch_offset = 0;
      int r;
 

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