From: Mathieu Desnoyers Date: Tue, 15 Aug 2017 21:54:34 +0000 (-0400) Subject: Fix: overflowed return value X-Git-Url: https://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=9a75ec7b3243b7a0ddbd3f0b0267a52edeeb4888 Fix: overflowed return value 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 Signed-off-by: Jérémie Galarneau --- diff --git a/plugins/ctf/common/metadata/visitor-generate-ir.c b/plugins/ctf/common/metadata/visitor-generate-ir.c index f8f9538b..a2ced0cb 100644 --- a/plugins/ctf/common/metadata/visitor-generate-ir.c +++ b/plugins/ctf/common/metadata/visitor-generate-ir.c @@ -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