[PATCH] drm/amdgpu: clear seq64 memory on free
Arunpravin Paneer Selvam
Arunpravin.PaneerSelvam at amd.com
Mon Apr 15 18:48:37 UTC 2024
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 at 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
More information about the amd-gfx
mailing list