[Intel-gfx] [PATCH] aubdump: Don't bail if a GEM handle of 0 is passed into execbuf

Rafael Antognolli rafael.antognolli at intel.com
Fri Apr 14 18:34:29 UTC 2017


Patch is
Reviewed-by: Rafael Antognolli <rafael.antognolli at intel.com>

On Fri, Mar 24, 2017 at 04:45:01PM -0700, Jason Ekstrand wrote:
> A gem handle of 0 can be used to check for whether or not 48-bit
> addressing is available.  This keeps aubdump from failing on you if
> you try to do the check.
> ---
>  tools/aubdump.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/aubdump.c b/tools/aubdump.c
> index 8a89b8c..3aca7eb 100644
> --- a/tools/aubdump.c
> +++ b/tools/aubdump.c
> @@ -131,7 +131,6 @@ get_bo(uint32_t handle)
>  
>  	fail_if(handle >= MAX_BO_COUNT, "bo handle too large\n");
>  	bo = &bos[handle];
> -	fail_if(bo->size == 0, "invalid bo handle (%d) in execbuf\n", handle);
>  
>  	return bo;
>  }
> @@ -442,7 +441,7 @@ dump_execbuffer2(int fd, struct drm_i915_gem_execbuffer2 *execbuffer2)
>  			offset = align_u32(offset + bo->size + 4095, 4096);
>  		}
>  
> -		if (bo->map == NULL)
> +		if (bo->map == NULL && bo->size > 0)
>  			bo->map = gem_mmap(fd, obj->handle, 0, bo->size);
>  		fail_if(bo->map == MAP_FAILED, "intel_aubdump: bo mmap failed\n");
>  	}
> @@ -583,7 +582,7 @@ maybe_init(void)
>  	}
>  	fclose(config);
>  
> -	bos = malloc(MAX_BO_COUNT * sizeof(bos[0]));
> +	bos = calloc(MAX_BO_COUNT, sizeof(bos[0]));
>  	fail_if(bos == NULL, "intel_aubdump: out of memory\n");
>  }
>  
> -- 
> 2.5.0.400.gff86faf
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx


More information about the Intel-gfx mailing list