From: Mathieu Desnoyers Date: Thu, 26 Nov 2020 20:36:20 +0000 (-0500) Subject: Fix: remove dead code in msgpack.c X-Git-Tag: v2.13.0-rc1~78 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=9b6ae9f609ebdc4708ef97e307ad2c39d9d94e5b;p=lttng-modules.git Fix: remove dead code in msgpack.c Identified by Coverity. Comparing unsigned types < 0 is never true. Signed-off-by: Mathieu Desnoyers --- diff --git a/src/lib/msgpack/msgpack.c b/src/lib/msgpack/msgpack.c index 0803bc65..f3eca64a 100644 --- a/src/lib/msgpack/msgpack.c +++ b/src/lib/msgpack/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; }