[Mesa-dev] [PATCH] i965: Fix shadowing of 'height' parameter
Ian Romanick
idr at freedesktop.org
Wed May 25 16:44:44 UTC 2016
Yikes.
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
On 05/25/2016 09:33 AM, Kristian Høgsberg wrote:
> From: Kristian Høgsberg Kristensen <krh at bitplanet.net>
>
> The nested declaration of 'height' shadows a parameter and uses
> uninitialized memory. Fix by renaming to 'plane_height' which also makes
> the code clearer.
>
> This would typically break the bo size computation, but we don't use
> that except when mmaping, and we don't mmap YUV buffers much.
>
> Signed-off-by: Kristian Høgsberg Kristensen <krh at bitplanet.net>
> ---
> src/mesa/drivers/dri/i965/intel_screen.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
> index 19a6678..4f14201 100644
> --- a/src/mesa/drivers/dri/i965/intel_screen.c
> +++ b/src/mesa/drivers/dri/i965/intel_screen.c
> @@ -732,8 +732,8 @@ intel_create_image_from_fds(__DRIscreen *screen,
> image->offsets[index] = offsets[index];
> image->strides[index] = strides[index];
>
> - const int height = height >> f->planes[i].height_shift;
> - const int end = offsets[index] + height * strides[index];
> + const int plane_height = height >> f->planes[i].height_shift;
> + const int end = offsets[index] + plane_height * strides[index];
> if (size < end)
> size = end;
> }
>
More information about the mesa-dev
mailing list