[Mesa-dev] [PATCH] st/mesa: check ureg_create() retval in create_pbo_upload_vs()

Nicolai Hähnle nhaehnle at gmail.com
Tue Feb 9 14:45:55 UTC 2016


On 09.02.2016 05:40, Samuel Pitoiset wrote:
> This avoids a possible NULL dereference because ureg_create() might
> return a NULL pointer.
>
> Spotted by coverity.

Thanks.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> Cc: Nicolai Hähnle <nicolai.haehnle at amd.com>
> ---
>   src/mesa/state_tracker/st_cb_texture.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
> index e9ac9a6..bdd2f63 100644
> --- a/src/mesa/state_tracker/st_cb_texture.c
> +++ b/src/mesa/state_tracker/st_cb_texture.c
> @@ -1132,6 +1132,8 @@ create_pbo_upload_vs(struct st_context *st)
>      struct ureg_dst out_layer;
>
>      ureg = ureg_create(TGSI_PROCESSOR_VERTEX);
> +   if (!ureg)
> +      return NULL;
>
>      in_pos = ureg_DECL_vs_input(ureg, TGSI_SEMANTIC_POSITION);
>
>


More information about the mesa-dev mailing list