Am 17.08.23 um 21:42 schrieb Joshua Peisach:
The argument passed to _insert_nop is a uint32_t, and the loop
counts to a regular integer. In the event of the argument being
larger than the maximum integer size, the regular integer would
become negative, and never reach the count number.
So, match the type to prevent an infinite loop.
Well that's not really necessary. The number of nops inserted could fit
into 8 bits as well.
Christian.
Signed-off-by: Joshua Peisach <itzswirlz2020@xxxxxxxxxxx>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
index 80d6e132e..273894441 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
@@ -108,7 +108,7 @@ int amdgpu_ring_alloc(struct amdgpu_ring *ring, unsigned int ndw)
*/
void amdgpu_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
{
- int i;
+ u32 i;
for (i = 0; i < count; i++)
amdgpu_ring_write(ring, ring->funcs->nop);