Skip to content

Commit

Permalink
drm/amdgpu: Fix out-of-bounds read of df_v1_7_channel_number
Browse files Browse the repository at this point in the history
[ Upstream commit d768394 ]

Check the fb_channel_number range to avoid the array out-of-bounds
read error

Signed-off-by: Ma Jun <[email protected]>
Reviewed-by: Tim Huang <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
Ma Jun authored and gregkh committed Sep 8, 2024
1 parent a914c14 commit db7a866
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/gpu/drm/amd/amdgpu/df_v1_7.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ static u32 df_v1_7_get_hbm_channel_number(struct amdgpu_device *adev)
int fb_channel_number;

fb_channel_number = adev->df.funcs->get_fb_channel_number(adev);
if (fb_channel_number >= ARRAY_SIZE(df_v1_7_channel_number))
fb_channel_number = 0;

return df_v1_7_channel_number[fb_channel_number];
}
Expand Down

0 comments on commit db7a866

Please sign in to comment.