Mesa (master): radv: fix a potential crash if attachments allocation failed

Samuel Pitoiset hakzsam at kemper.freedesktop.org
Fri Sep 15 07:19:27 UTC 2017


Module: Mesa
Branch: master
Commit: 8e8c7c670340e747e9860fb6cbfc3e89f315fcc2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8e8c7c670340e747e9860fb6cbfc3e89f315fcc2

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Thu Sep 14 18:47:04 2017 +0200

radv: fix a potential crash if attachments allocation failed

Also, it's useless to set the error code twice. Though, we
should probably skip the next commands when the command buffer
is considered invalid.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

---

 src/amd/vulkan/radv_cmd_buffer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 068247d04d..5f22733a7d 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -2771,9 +2771,10 @@ void radv_CmdBeginRenderPass(
 	cmd_buffer->state.framebuffer = framebuffer;
 	cmd_buffer->state.pass = pass;
 	cmd_buffer->state.render_area = pRenderPassBegin->renderArea;
+
 	result = radv_cmd_state_setup_attachments(cmd_buffer, pass, pRenderPassBegin);
 	if (result != VK_SUCCESS)
-		cmd_buffer->record_result = result;
+		return;
 
 	radv_cmd_buffer_set_subpass(cmd_buffer, pass->subpasses, true);
 	assert(cmd_buffer->cs->cdw <= cdw_max);




More information about the mesa-commit mailing list