[Mesa-dev] [PATCH] util: Move dereference after null check in util_resource_copy_region.
Brian Paul
brianp at vmware.com
Sat Aug 4 07:18:03 PDT 2012
On 08/04/2012 12:42 AM, Vinson Lee wrote:
> Fixes deference before null check defect reported by Coverity.
>
> Signed-off-by: Vinson Lee<vlee at freedesktop.org>
> ---
> src/gallium/auxiliary/util/u_surface.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c
> index a541a38..fcfff14 100644
> --- a/src/gallium/auxiliary/util/u_surface.c
> +++ b/src/gallium/auxiliary/util/u_surface.c
> @@ -160,12 +160,12 @@ util_resource_copy_region(struct pipe_context *pipe,
> unsigned h = src_box->height;
>
> assert(src&& dst);
> - assert((src->target == PIPE_BUFFER&& dst->target == PIPE_BUFFER) ||
> - (src->target != PIPE_BUFFER&& dst->target != PIPE_BUFFER));
> -
> if (!src || !dst)
> return;
>
> + assert((src->target == PIPE_BUFFER&& dst->target == PIPE_BUFFER) ||
> + (src->target != PIPE_BUFFER&& dst->target != PIPE_BUFFER));
> +
> src_format = src->format;
> dst_format = dst->format;
>
Reviewed-by: Brian Paul <brianp at vmware.com>
More information about the mesa-dev
mailing list