From d7911f9c6b0510b74c96306f748ff19d0f4807ba Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 9 Dec 2020 18:51:16 -0800 Subject: mesa: Remove cmd_size < 0 check. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cmd_size was changed to size_t in commit 4b2445916e6 ("glthread: change sizes to unsigned or size_t where needed"). Fix defect reported by Coverity Scan. Macro compares unsigned to 0 (NO_EFFECT) unsigned_compare: This less-than-zero comparison of an unsigned value is never true. cmd_size < 0UL Signed-off-by: Vinson Lee Reviewed-by: Marek Olšák Part-of: --- src/mesa/main/glthread_bufferobj.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mesa/main/glthread_bufferobj.c b/src/mesa/main/glthread_bufferobj.c index 2df10421b98..a3516cdb152 100644 --- a/src/mesa/main/glthread_bufferobj.c +++ b/src/mesa/main/glthread_bufferobj.c @@ -280,8 +280,7 @@ _mesa_marshal_BufferData_merged(GLuint target_or_name, GLsizeiptr size, bool copy_data = data && !external_mem; size_t cmd_size = sizeof(struct marshal_cmd_BufferData) + (copy_data ? size : 0); - if (unlikely(size < 0 || size > INT_MAX || cmd_size < 0 || - cmd_size > MARSHAL_MAX_CMD_SIZE || + if (unlikely(size < 0 || size > INT_MAX || cmd_size > MARSHAL_MAX_CMD_SIZE || (named && target_or_name == 0))) { _mesa_glthread_finish_before(ctx, func); if (named) { -- cgit v1.2.3