[Mesa-dev] [PATCH 1/4] r600_state_common: check NULL return from u_upload_alloc

Nicolai Hähnle nhaehnle at gmail.com
Fri Mar 24 11:19:09 UTC 2017


I generally like the patches in the series, thanks for that. Two points 
though:

1. The order of patches in series is usually general code before driver 
code, i.e. the st/cb_bitmap should come first.

2. I don't like having silent errors, as that could be confusing. In 
places where the error isn't propagated to the application (as it really 
should be...), I think we should have an fprintf to stderr.

Cheers,
Nicolai

On 24.03.2017 12:08, Julien Isorce wrote:
> Like done in si_state_draw.c::si_draw_vbo
>
> Signed-off-by: Julien Isorce <jisorce at oblong.com>
> ---
>  src/gallium/drivers/r600/r600_state_common.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
> index 6f8279f..cedeb74 100644
> --- a/src/gallium/drivers/r600/r600_state_common.c
> +++ b/src/gallium/drivers/r600/r600_state_common.c
> @@ -1746,6 +1746,10 @@ static void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info
>
>  			u_upload_alloc(ctx->stream_uploader, start, count * 2,
>                                         256, &out_offset, &out_buffer, &ptr);
> +			if (unlikely(!ptr)) {
> +				pipe_resource_reference(&ib.buffer, NULL);
> +				return;
> +			}
>
>  			util_shorten_ubyte_elts_to_userptr(
>  						&rctx->b.b, &ib, 0, 0, ib.offset + start, count, ptr);
>


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list