drm/amdgpu: add bounds check to prevent array overflow
Subsystems (2)
PATCH 1/2 drm/amdgpu: add bounds check to prevent array overflow
Add bounds check to prevent array overflow.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +3 -0
@@ -5064,6 +5064,9 @@ static void amdgpu_register_bad_pages_mca_notifier(struct amdgpu_device *adev)* Use this list instead of mgpu_info to find the amdgpu * device on which the UMC error was reported. */ +if (mce_adev_list.num_gpu >=MAX_GPU_INSTANCE ) +return ; + mce_adev_list.devs[mce_adev_list.num_gpu++] = adev;/*
Signature · 1 line
2.43.0
PATCH 2/2 drm/amd/ras: use IS_ERR() to check thread creation result
Use IS_ERR() to check thread creation result.
--- drivers/gpu/drm/amd/ras/rascore/ras_process.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/ras/rascore/ras_process.c +3 -2
@@ -248,9 +248,10 @@ int ras_process_init(struct ras_core_context *ras_core) ras_proc->ras_process_thread =kthread_run (ras_process_thread, (void *)ras_core,"ras_process_thread" ); -if (!ras_proc->ras_process_thread) { +if (IS_ERR (ras_proc->ras_process_thread)) {RAS_DEV_ERR (ras_core->dev,"Failed to create ras_process_thread.\n" ); - ret = -ENOMEM ; + ret =PTR_ERR (ras_proc->ras_process_thread); + ras_proc->ras_process_thread =NULL ; goto err; }
Signature · 1 line
2.43.0
AMD General
Quoted 22 lines
-----Original Message-----
From: Chai, Thomas <[email protected]>
Sent: Tuesday, June 16, 2026 4:44 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Li, Candice <[email protected]>; Chai, Thomas <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: add bounds check to prevent array overflowAdd bounds check to prevent array overflow.
Signed-off-by YiPeng Chai <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c static void · line 5068
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-0@@ -5064,6 +5064,9 @@ static voidamdgpu_register_bad_pages_mca_notifier(struct amdgpu_device *adev) * Use this list instead of mgpu_info to find the amdgpu * device on which the UMC error was reported. */ +if (mce_adev_list.num_gpu >=MAX_GPU_INSTANCE )
[Tao] do we need to add warning message for it?
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +2
-0+return ; + mce_adev_list.devs[mce_adev_list.num_gpu++] = adev;/*--
2.43.0
AMD General
OK
Best Regards,
Thomas
-----Original Message-----
From: Zhou1, Tao <[email protected]>
Sent: Tuesday, June 16, 2026 4:58 PM
To: Chai, Thomas <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Li, Candice <[email protected]>
Subject: RE: [PATCH 1/2] drm/amdgpu: add bounds check to prevent array overflow
AMD General
Quoted 23 lines
-----Original Message-----
From: Chai, Thomas <[email protected]>
Sent: Tuesday, June 16, 2026 4:44 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Li, Candice <[email protected]>; Chai, Thomas <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: add bounds check to prevent array overflowAdd bounds check to prevent array overflow.
Signed-off-by YiPeng Chai <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c static void · line 5068
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-0@@ -5064,6 +5064,9 @@ static voidamdgpu_register_bad_pages_mca_notifier(struct amdgpu_device *adev) * Use this list instead of mgpu_info to find the amdgpu * device on which the UMC error was reported. */ +if (mce_adev_list.num_gpu >=MAX_GPU_INSTANCE )
[Tao] do we need to add warning message for it?
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +2
-0+return ; + mce_adev_list.devs[mce_adev_list.num_gpu++] = adev;/*--
2.43.0