Fix: overflowed return value
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 15 Aug 2017 21:54:34 +0000 (17:54 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 15 Aug 2017 22:06:57 +0000 (18:06 -0400)
Found by Coverity (attempt to fix, unsure it will convince Coverity of
the holiness of our code):

2. overflow: Subtract operation overflows on operands align and 1UL.

CID 1376162 (#1 of 1): Overflowed return value (INTEGER_OVERFLOW)3.
overflow_sink: Overflowed or truncated value (or a value computed from
an overflowed or truncated value) align != 0UL && !(align & align - 1UL)
used as return value.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
plugins/ctf/common/metadata/visitor-generate-ir.c

index f8f9538bf89d45ca34f7e535e138b6384d35a3c1..a2ced0cbed197266ecaddae2f885b24c5049f163 100644 (file)
@@ -1039,7 +1039,7 @@ enum bt_ctf_byte_order get_real_byte_order(struct ctx *ctx,
 static
 int is_align_valid(uint64_t align)
 {
-       return (align != 0) && !(align & (align - 1));
+       return (align != 0) && !(align & (align - 1ULL));
 }
 
 static
This page took 0.026859 seconds and 4 git commands to generate.