drm/amd/display: dc_get_vmid_use_vector() crashes when get called

[Why]
int i can go out of boundary which will cause crash

[How]
Fixed the maximum value of i to avoid i going out of boundary

Signed-off-by: Peikang Zhang <peikang.zhang@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Peikang Zhang 2020-01-20 09:25:15 -05:00 committed by Alex Deucher
parent 76c332c3d4
commit 68bbca15e7
1 changed files with 1 additions and 1 deletions

View File

@ -62,7 +62,7 @@ int dc_get_vmid_use_vector(struct dc *dc)
int i;
int in_use = 0;
for (i = 0; i < dc->vm_helper->num_vmid; i++)
for (i = 0; i < MAX_HUBP; i++)
in_use |= dc->vm_helper->hubp_vmid_usage[i].vmid_usage[0]
| dc->vm_helper->hubp_vmid_usage[i].vmid_usage[1];
return in_use;