mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-09 10:30:13 +01:00
venus: fix ffb batch prepare for a corner case and avoid a memcpy UB
Batches must be ignored if batch count is zero, so all batch inspections
have to be gated behind batch count. For memcpy, it's UB if either src
or dst is NULL even when size is zero.
Side note:
- For original commit, this fixes just the memcpy UB
- For current codes, this fixes to not skip ffb batch prepare
Fixes: 493a3b5cda ("venus: refactor batch submission fixup")
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28071>
This commit is contained in:
parent
f5532f8bab
commit
8af267eb00
1 changed files with 1 additions and 1 deletions
|
|
@ -807,7 +807,7 @@ vn_queue_submission_setup_batches(struct vn_queue_submission *submit)
|
|||
* - non-empty: copy batches for adding feedbacks
|
||||
* - empty: initialize a batch for fence feedback
|
||||
*/
|
||||
if (submit->batches) {
|
||||
if (submit->batch_count) {
|
||||
memcpy(submit->temp.batches, submit->batches,
|
||||
vn_get_batch_size(submit) * submit->batch_count);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue