From 618e480f3854d8e79187e16152c9cee47146258d Mon Sep 17 00:00:00 2001 From: Andrii Simiklit Date: Mon, 7 Dec 2020 12:50:28 +0200 Subject: [PATCH] glx: lets compare drawing command sizes using MIN3 It has to fix coverity issue CID1470555: ``` 481 if (bufSize > __GLX_RENDER_CMD_SIZE_LIMIT) { 482 bufSize = __GLX_RENDER_CMD_SIZE_LIMIT; 483 } 484 if (bufSize > __GLX_MAX_RENDER_CMD_SIZE) { >>> CID 1470555: Control flow issues (DEADCODE) >>> Execution cannot reach this statement: "bufSize = 64000;". 485 bufSize = __GLX_MAX_RENDER_CMD_SIZE; 486 } ``` Reviewed-by: Eric Anholt Signed-off-by: Andrii Simiklit Part-of: --- src/glx/indirect_glx.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c index 5c8e71b..3f3e1c8 100644 --- a/src/glx/indirect_glx.c +++ b/src/glx/indirect_glx.c @@ -478,14 +478,9 @@ indirect_create_context_attribs(struct glx_screen *psc, ** constrain by a software limit, then constrain by the protocl ** limit. */ - if (bufSize > __GLX_RENDER_CMD_SIZE_LIMIT) { - bufSize = __GLX_RENDER_CMD_SIZE_LIMIT; - } - if (bufSize > __GLX_MAX_RENDER_CMD_SIZE) { - bufSize = __GLX_MAX_RENDER_CMD_SIZE; - } - gc->maxSmallRenderCommandSize = bufSize; - + gc->maxSmallRenderCommandSize = MIN3(bufSize, __GLX_RENDER_CMD_SIZE_LIMIT, + __GLX_MAX_RENDER_CMD_SIZE); + return gc; } -- 2.7.4