[Mesa-dev] [PATCH] i965/fs: fix uninitialized memory access

Jordan Justen jordan.l.justen at intel.com
Thu Feb 16 18:10:43 UTC 2017


Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>

On 2017-02-16 07:06:09, Lionel Landwerlin wrote:
> Found while running shader-db under valgrind.
> 
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
> ---
>  src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
> index f56f05b7e9..952276faed 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
> @@ -207,9 +207,8 @@ fs_visitor::register_coalesce()
>              channels_remaining = -1;
>              continue;
>           }
> -         dst_reg_offset[offset] = inst->dst.offset / REG_SIZE;
> -         if (inst->size_written > REG_SIZE)
> -            dst_reg_offset[offset + 1] = inst->dst.offset / REG_SIZE + 1;
> +         for (unsigned i = 0; i < MAX2(inst->size_written / REG_SIZE, 1); i++)
> +            dst_reg_offset[offset + i] = inst->dst.offset / REG_SIZE + i;
>           mov[offset] = inst;
>           channels_remaining -= regs_written(inst);
>        }
> -- 
> 2.11.0
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list