[Mesa-dev] [PATCH] vulkan: Fix use of uninitialized variable.

Eric Engestrom eric.engestrom at imgtec.com
Wed May 4 08:31:12 UTC 2016


On Tue, May 03, 2016 at 06:46:39PM -0400, robert.foss at collabora.com wrote:
> From: Robert Foss <robert.foss at collabora.com>
> 
> The return variable was not set for failure paths.
> It has now been changed to VK_ERROR_INITIALIZATION_FAILED
> for failure paths.
> 
> Coverity: 1358944
> Signed-off-by: Robert Foss <robert.foss at collabora.com>
> ---
>  src/intel/vulkan/anv_wsi_wayland.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/src/intel/vulkan/anv_wsi_wayland.c b/src/intel/vulkan/anv_wsi_wayland.c
> index 6f25eaf..6e723ee 100644
> --- a/src/intel/vulkan/anv_wsi_wayland.c
> +++ b/src/intel/vulkan/anv_wsi_wayland.c
> @@ -776,12 +776,16 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
>     chain->queue = NULL;
>  
>     chain->display = wsi_wl_get_display(device->instance, surface->display);
> -   if (!chain->display)
> +   if (!chain->display) {
> +      result = VK_ERROR_INITIALIZATION_FAILED;

result = vk_error(VK_ERROR_INITIALIZATION_FAILED);

>        goto fail;
> +   }
>  
>     chain->queue = wl_display_create_queue(chain->display->display);
> -   if (!chain->queue)
> +   if (!chain->queue) {
> +      result = VK_ERROR_INITIALIZATION_FAILED;

ditto

>        goto fail;
> +   }
>  
>     for (uint32_t i = 0; i < chain->image_count; i++) {
>        result = wsi_wl_image_init(chain, &chain->images[i], pAllocator);
> -- 
> 2.5.0

With that fixed:
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>


More information about the mesa-dev mailing list