mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 13:48:06 +02:00
pvr: add deferred RTA clear command to list after checking it's not NULL
The code that adds deferred RTA clear transfer commands checks whether
the newly allocated transfer command is NULL. However the list_addtail
call is before the check, which means that the check does not prevent
NULL dereference.
Reorder the code to ensure no NULL transfer commands would ever be added
to the deferred clear list.
In addition, pvr_transfer_cmd_alloc() has already set the command
buffer's error status when it returns NULL, so it's not needed to set it
again.
Fixes: 2eabbbe57d ("pvr: use linked list to back deferred clears")
Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
Reviewed-by: Luigi Santivetti <luigi.santivetti@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40838>
This commit is contained in:
parent
40e0f0f933
commit
ecd4e93456
1 changed files with 2 additions and 5 deletions
|
|
@ -2005,14 +2005,11 @@ static VkResult pvr_add_deferred_rta_clear(struct pvr_cmd_buffer *cmd_buffer,
|
|||
continue;
|
||||
|
||||
transfer_cmd = pvr_transfer_cmd_alloc(cmd_buffer);
|
||||
if (!transfer_cmd)
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
|
||||
list_addtail(&transfer_cmd->link, &cmd_buffer->deferred_clears);
|
||||
|
||||
if (!transfer_cmd) {
|
||||
return vk_command_buffer_set_error(&cmd_buffer->vk,
|
||||
VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
}
|
||||
|
||||
transfer_cmd->flags = PVR_TRANSFER_CMD_FLAGS_FILL;
|
||||
|
||||
if (attachment->aspectMask == VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue