From 8b914423d8af8805685f6114888f3bbd3b528d0f Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 26 Nov 2020 15:35:31 -0500 Subject: [PATCH] Fix: remove dead code in msgpack.c Identified by Coverity. Comparing unsigned types < 0 is never true. Signed-off-by: Mathieu Desnoyers Change-Id: Ic623a5b15c7053844c8e3a0b374ac3b9b929c050 --- libmsgpack/msgpack.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libmsgpack/msgpack.c b/libmsgpack/msgpack.c index 0803bc65..f3eca64a 100644 --- a/libmsgpack/msgpack.c +++ b/libmsgpack/msgpack.c @@ -316,7 +316,7 @@ int lttng_msgpack_begin_map(struct lttng_msgpack_writer *writer, size_t count) { int ret; - if (count < 0 || count >= (1 << 16)) { + if (count >= (1 << 16)) { ret = -1; goto end; } @@ -343,7 +343,7 @@ int lttng_msgpack_begin_array( { int ret; - if (count < 0 || count >= (1 << 16)) { + if (count >= (1 << 16)) { ret = -1; goto end; } @@ -370,7 +370,8 @@ int lttng_msgpack_write_str(struct lttng_msgpack_writer *writer, { int ret; size_t length = strlen(str); - if (length < 0 || length >= (1 << 16)) { + + if (length >= (1 << 16)) { ret = -1; goto end; } -- 2.34.1