radeonsi/vcn: Fix out of bounds write when invalidating QP map regions

Fixes coverity issue 1559460 Out-of-bounds write

Fixes: 9c07a2e10d ("radeonsi/vcn: ROI feature implementation")

Reviewed-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31558>
(cherry picked from commit 10a7356488)
This commit is contained in:
David Rosca 2024-10-08 10:49:50 +02:00 committed by Eric Engestrom
parent ce61b23c69
commit 36e2c67194
2 changed files with 2 additions and 2 deletions

View file

@ -1214,7 +1214,7 @@
"description": "radeonsi/vcn: Fix out of bounds write when invalidating QP map regions",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "9c07a2e10d6d0999b50c33ce4b893ada4a5000c5",
"notes": null

View file

@ -161,7 +161,7 @@ static void radeon_vcn_enc_get_roi_param(struct radeon_encoder *enc,
qp_map->width_in_block = width_in_block;
qp_map->height_in_block = height_in_block;
for (i = RENCODE_QP_MAP_MAX_REGIONS; i >= roi->num; i--)
for (i = RENCODE_QP_MAP_MAX_REGIONS - 1; i >= roi->num; i--)
enc->enc_pic.enc_qp_map.map[i].is_valid = false;
/* reverse the map sequence */