X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fenable_channels.c;h=55fbae644abc0b6dc4813988a7913e7fa169759e;hb=2c521c63a46d6c79a7819a822d109ccdd48b6064;hp=18f8d020eef5089ef4309ec9608a3ebd5589fcd7;hpb=b9dfb1671626365019a72318fb131eb321244245;p=lttng-tools.git diff --git a/src/bin/lttng/commands/enable_channels.c b/src/bin/lttng/commands/enable_channels.c index 18f8d020e..55fbae644 100644 --- a/src/bin/lttng/commands/enable_channels.c +++ b/src/bin/lttng/commands/enable_channels.c @@ -169,7 +169,7 @@ static void set_default_attr(struct lttng_domain *dom) if (chan.attr.read_timer_interval == -1) { chan.attr.read_timer_interval = default_attr.read_timer_interval; } - if (chan.attr.output == -1) { + if ((int) chan.attr.output == -1) { chan.attr.output = default_attr.output; } if (chan.attr.tracefile_count == -1) { @@ -356,6 +356,13 @@ int cmd_enable_channels(int argc, const char **argv) order = get_count_order_u64(chan.attr.subbuf_size); assert(order >= 0); rounded_size = 1ULL << order; + if (rounded_size < chan.attr.subbuf_size) { + ERR("The subbuf size (%" PRIu64 ") is rounded and overflows!", + chan.attr.subbuf_size); + ret = CMD_ERROR; + goto end; + } + if (rounded_size != chan.attr.subbuf_size) { WARN("The subbuf size (%" PRIu64 ") is rounded to the next power of 2 (%" PRIu64 ")", chan.attr.subbuf_size, rounded_size); @@ -385,6 +392,13 @@ int cmd_enable_channels(int argc, const char **argv) order = get_count_order_u64(chan.attr.num_subbuf); assert(order >= 0); rounded_size = 1ULL << order; + if (rounded_size < chan.attr.num_subbuf) { + ERR("The number of subbuffers (%" PRIu64 ") is rounded and overflows!", + chan.attr.num_subbuf); + ret = CMD_ERROR; + goto end; + } + if (rounded_size != chan.attr.num_subbuf) { WARN("The number of subbuffers (%" PRIu64 ") is rounded to the next power of 2 (%" PRIu64 ")", chan.attr.num_subbuf, rounded_size);