All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: clear seq64 memory on free
@ 2024-04-15 18:48 Arunpravin Paneer Selvam
  2024-04-16  9:05 ` Christian König
  0 siblings, 1 reply; 7+ messages in thread
From: Arunpravin Paneer Selvam @ 2024-04-15 18:48 UTC (permalink / raw)
  To: amd-gfx; +Cc: christian.koenig, alexander.deucher, Arunpravin Paneer Selvam

We should clear the memory on free. Otherwise,
there is a chance that we will access the previous
application data and this would leads to an abnormal
behaviour in the current application.

Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_seq64.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_seq64.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_seq64.c
index 4b9afc4df031..9613992c9804 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_seq64.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_seq64.c
@@ -189,10 +189,14 @@ int amdgpu_seq64_alloc(struct amdgpu_device *adev, u64 *va, u64 **cpu_addr)
 void amdgpu_seq64_free(struct amdgpu_device *adev, u64 va)
 {
 	unsigned long bit_pos;
+	u64 *cpu_addr;
 
 	bit_pos = (va - amdgpu_seq64_get_va_base(adev)) / sizeof(u64);
-	if (bit_pos < adev->seq64.num_sem)
+	if (bit_pos < adev->seq64.num_sem) {
+		cpu_addr = bit_pos + adev->seq64.cpu_base_addr;
+		memset(cpu_addr, 0, sizeof(u64));
 		__clear_bit(bit_pos, adev->seq64.used);
+	}
 }
 
 /**
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-04-16 12:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-15 18:48 [PATCH] drm/amdgpu: clear seq64 memory on free Arunpravin Paneer Selvam
2024-04-16  9:05 ` Christian König
2024-04-16 12:16   ` Paneer Selvam, Arunpravin
2024-04-16 12:17     ` Christian König
2024-04-16 12:34       ` Paneer Selvam, Arunpravin
2024-04-16 12:54         ` Christian König
2024-04-16 12:57           ` Paneer Selvam, Arunpravin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.