From: Sergii Melikhov Date: Mon, 2 Aug 2021 12:15:34 +0000 (+0300) Subject: iris: Fix Null pointer dereferences X-Git-Tag: upstream/22.3.5~19560 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d16b9b27b0f2fdc3416b4c50c16711c5eec063b2;p=platform%2Fupstream%2Fmesa.git iris: Fix Null pointer dereferences Fix the error from Coverity report: CID 1489765 Signed-off-by: Sergii Melikhov Reviewed-by: Lionel Landwerlin Reviewed-by: Ian Romanick Part-of: --- diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index f4a1e68..f67be3f 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -1372,9 +1372,9 @@ iris_update_compiled_vs(struct iris_context *ice) IRIS_STAGE_DIRTY_CONSTANTS_VS; shs->sysvals_need_upload = true; - const struct brw_vue_prog_data *vue_prog_data = - (void *) shader->prog_data; - check_urb_size(ice, vue_prog_data->urb_entry_size, MESA_SHADER_VERTEX); + unsigned urb_entry_size = shader ? + ((struct brw_vue_prog_data *) shader->prog_data)->urb_entry_size : 0; + check_urb_size(ice, urb_entry_size, MESA_SHADER_VERTEX); } } @@ -1604,8 +1604,9 @@ iris_update_compiled_tcs(struct iris_context *ice) IRIS_STAGE_DIRTY_CONSTANTS_TCS; shs->sysvals_need_upload = true; - const struct brw_vue_prog_data *prog_data = (void *) shader->prog_data; - check_urb_size(ice, prog_data->urb_entry_size, MESA_SHADER_TESS_CTRL); + unsigned urb_entry_size = shader ? + ((struct brw_vue_prog_data *) shader->prog_data)->urb_entry_size : 0; + check_urb_size(ice, urb_entry_size, MESA_SHADER_TESS_CTRL); } } @@ -1730,8 +1731,9 @@ iris_update_compiled_tes(struct iris_context *ice) IRIS_STAGE_DIRTY_CONSTANTS_TES; shs->sysvals_need_upload = true; - const struct brw_vue_prog_data *prog_data = (void *) shader->prog_data; - check_urb_size(ice, prog_data->urb_entry_size, MESA_SHADER_TESS_EVAL); + unsigned urb_entry_size = shader ? + ((struct brw_vue_prog_data *) shader->prog_data)->urb_entry_size : 0; + check_urb_size(ice, urb_entry_size, MESA_SHADER_TESS_EVAL); } /* TODO: Could compare and avoid flagging this. */