[Mesa-dev] [PATCH 00/10] Klocwork related pathes

Ian Romanick idr at freedesktop.org
Mon Feb 17 13:03:02 PST 2014


On 02/17/2014 08:21 AM, Juha-Pekka Heikkila wrote:
> Resend of the earlier glx patches with the issue pointed out by Petri fixed.
> 
> Patch number five is a bit special. hash_table_insert() and 
> hash_table_replace() don't really have a way to report errors and I did not 
> want to go changing the api since these are called from so many places thus 
> the case of null (c)allocation is handled just inside the functions and 
> relied low memory situation is handled outside the function properly.

Right.  I'm a bit skeptical about patches 5 and 9 for that reason.  I
think if we add a function _mesa_error_no_memory(void) to
src/mesa/errors.c that can at least set GL_OUT_OF_MEMORY in the context,
I'd be a bit more happy.  The GL spec allows us to leave things in an
indeterminate state when we're out of memory.  We really do need to let
the application know what happend, though.

Something like...

void
_mesa_error_no_memory(void)
{
   GET_CURRENT_CONTEXT(ctx);

   _mesa_error(ctx, GL_OUT_OF_MEMORY, "out of memory");
}

ought to be enough.  We do need to audit the various paths through
_mesa_error to make sure they can handle no memory situations.

> Patch number eight is not from Klocwork. There was two nested for loops
> running against table eventually doing an assert in check_symbol_table(), 
> this was included also for optimized builds. Now these loops will run only
> on debug builds where assert could matter.
> 
> Juha-Pekka Heikkila (10):
>   glx: Add extra null check in __glXClientInfo
>   glx: add extra null check in getFBConfigs
>   glx: add missing null check in SendMakeCurrentRequest
>   egl: Unhide functionality in _eglInitSync()
>   mesa: Add missing null checks into prog_hash_table.c
>   mesa: Prevent negative indexing on noise2, noise3 and noise4
>   mesa: Add missing null check in _mesa_parse_arb_program()
>   mesa: remove redundant running of check_symbol_table()
>   mesa: add null checks for callocs in symbol_table.c
>   mesa: add missing null checks in _tnl_register_fastpath()
> 
>  src/egl/main/eglsync.c             |  3 ++-
>  src/glx/glxcmds.c                  | 13 +++++++-----
>  src/glx/glxext.c                   |  3 ++-
>  src/glx/indirect_glx.c             |  2 +-
>  src/mesa/program/prog_hash_table.c | 16 +++++++++------
>  src/mesa/program/prog_noise.c      | 18 ++++++++---------
>  src/mesa/program/program_parse.y   |  5 +++++
>  src/mesa/program/symbol_table.c    | 28 ++++++++++++++++++++++----
>  src/mesa/tnl/t_vertex.c            | 41 ++++++++++++++++++++++----------------
>  9 files changed, 85 insertions(+), 44 deletions(-)
> 



More information about the mesa-dev mailing list