From: Mathieu Desnoyers Date: Thu, 26 Nov 2020 20:35:31 +0000 (-0500) Subject: Fix: remove dead code in msgpack.c X-Git-Tag: v2.13.0-rc1~426 X-Git-Url: http://git.lttng.org/?p=lttng-ust.git;a=commitdiff_plain;h=8b914423d8af8805685f6114888f3bbd3b528d0f 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 --- 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; }