Fix: remove dead code in msgpack.c
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 26 Nov 2020 20:36:20 +0000 (15:36 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 26 Nov 2020 20:36:46 +0000 (15:36 -0500)
Identified by Coverity. Comparing unsigned types < 0 is never true.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
src/lib/msgpack/msgpack.c

index 0803bc657646b49f4dcbc7c3ffad244a0ec33a44..f3eca64a654cd5cfcfcc9cfabdaf5fca387e5f46 100644 (file)
@@ -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;
        }
This page took 0.026776 seconds and 4 git commands to generate.