[Mesa-dev] [PATCH] i965/blorp: Remove unnecessary test in gen7_blorp_emit_depth_stencil_config.

Kenneth Graunke kenneth at whitecape.org
Tue Apr 9 10:40:22 PDT 2013


On 04/09/2013 06:32 AM, Paul Berry wrote:
> gen7_blorp_emit_depth_stencil_config() is only called when
> params->depth.mt is non-null.  Therefore, it's not necessary to do an
> "if (params->depth.mt)" test inside it.  The presence of this if test
> was misleading static analysis tools (and briefly, me) into thinking
> that gen7_blorp_emit_depth_stencil_config() might sometimes access
> uninitialized data and dereference a null pointer.
> ---
>   src/mesa/drivers/dri/i965/gen7_blorp.cpp | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
> index bfd2cbd..3138773 100644
> --- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp
> +++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
> @@ -584,10 +584,8 @@ gen7_blorp_emit_depth_stencil_config(struct brw_context *brw,
>      uint32_t draw_y = params->depth.y_offset;
>      uint32_t tile_mask_x, tile_mask_y;
>
> -   if (params->depth.mt) {
> -      brw_get_depthstencil_tile_masks(params->depth.mt, NULL,
> -                                      &tile_mask_x, &tile_mask_y);
> -   }
> +   brw_get_depthstencil_tile_masks(params->depth.mt, NULL,
> +                                   &tile_mask_x, &tile_mask_y);
>
>      /* 3DSTATE_DEPTH_BUFFER */
>      {

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>



More information about the mesa-dev mailing list