drm/amdgpu: Off by one in dm_dmub_outbox1_low_irq()
PATCH 1/1 drm/amdgpu: Off by one in dm_dmub_outbox1_low_irq()
The > ARRAY_SIZE() should be >= ARRAY_SIZE() to prevent an out of bounds access.
Fixes e27c41d5b068 ("drm/amd/display: Support for DMUB HPD interrupt handling")
Signed-off-by Dan Carpenter <[email protected]>
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
@@ -770,7 +770,7 @@ static void dm_dmub_outbox1_low_irq(void *interrupt_params) do { dc_stat_get_dmub_notification(adev->dm.dc, ¬ify); - if (notify.type > ARRAY_SIZE(dm->dmub_thread_offload)) { + if (notify.type >= ARRAY_SIZE(dm->dmub_thread_offload)) { DRM_ERROR("DM: notify type %d invalid!", notify.type); continue; }
Signature · 1 line
2.35.1
Quoted 5 lines · Dan Carpenter
The >
ARRAY_SIZE()should be >=ARRAY_SIZE()to prevent an out of bounds access.Fixes e27c41d5b068 ("drm/amd/display: Support for DMUB HPD interrupt handling")Signed-off-by Dan Carpenter <[email protected]>
Reviewed-by Harry Wentland <[email protected]>
Harry
Quoted 17 lines
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1
-1@@ -770,7 +770,7 @@ static void dm_dmub_outbox1_low_irq(void *interrupt_params) do { dc_stat_get_dmub_notification(adev->dm.dc, ¬ify); - if (notify.type > ARRAY_SIZE(dm->dmub_thread_offload)) { + if (notify.type >= ARRAY_SIZE(dm->dmub_thread_offload)) { DRM_ERROR("DM: notify type %d invalid!", notify.type); continue; }
Alex Deucher
AppliedApplied. Thanks!
Alex
Quoted 30 lines · Harry Wentland
Quoted 5 lines · Dan Carpenter
The >
ARRAY_SIZE()should be >=ARRAY_SIZE()to prevent an out of bounds access.Fixes e27c41d5b068 ("drm/amd/display: Support for DMUB HPD interrupt handling")Signed-off-by Dan Carpenter <[email protected]>Reviewed-by Harry Wentland <[email protected]>Harry
Quoted 17 lines
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1
-1@@ -770,7 +770,7 @@ static void dm_dmub_outbox1_low_irq(void *interrupt_params) do { dc_stat_get_dmub_notification(adev->dm.dc, ¬ify); - if (notify.type > ARRAY_SIZE(dm->dmub_thread_offload)) { + if (notify.type >= ARRAY_SIZE(dm->dmub_thread_offload)) { DRM_ERROR("DM: notify type %d invalid!", notify.type); continue; }