Philippe Proulx [Wed, 9 Aug 2017 22:12:34 +0000 (18:12 -0400)]
lib/plugin/plugin.c: log more details when g_module_open() fails
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 9 Aug 2017 22:13:33 +0000 (18:13 -0400)]
python-plugin-provider/Makefile.am: link to libbabeltrace
Make the Python plugin provider dependent on libbabeltrace because
it needs symbols from the library.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 16 Aug 2017 19:40:02 +0000 (15:40 -0400)]
Fix sink.ctf.fs: NULL dereference in logging statement
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 16 Aug 2017 19:29:11 +0000 (15:29 -0400)]
Fix filter.utils.muxer: NULL dereference in logging statement
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 15 Aug 2017 21:54:34 +0000 (17:54 -0400)]
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 <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 15 Aug 2017 21:36:19 +0000 (17:36 -0400)]
Fix: attempt to fix improper use of negative value
Found by Coverity, unsure that the fix will make it happy:
CID
1376189 (#1 of 1): Improper use of negative value
(NEGATIVE_RETURNS)negative_returns: Passing negative constant -1 to a
parameter that cannot be negative. [hide details]
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 15 Aug 2017 21:30:03 +0000 (17:30 -0400)]
Fix: add missing overflow check in bt_ctf_stream_pos_access_ok
Found by Coverity:
2. overflow: Subtract operation overflows on operands bit_offset and 1UL.
CID
1377278 (#1 of 1): Overflowed return value (INTEGER_OVERFLOW).
overflow_sink: Overflowed or truncated value (or a value computed from
an overflowed or truncated value) bt_ctf_stream_pos_move(pos, ({...}))
used as return value.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 15 Aug 2017 21:19:39 +0000 (17:19 -0400)]
Fix: uninitialized return value on error
Found by Coverity:
CID
1379248 (#1 of 1): Uninitialized scalar variable (UNINIT).
uninit_use: Using uninitialized value ret.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 15 Aug 2017 21:17:14 +0000 (17:17 -0400)]
Fix: handle unknown enum mapping
Found by Coverity:
At condition nr_mappings, the value of nr_mappings must be at least 1.
The condition !nr_mappings cannot be true.
CID
1376163 (#1 of 1): Logically dead code
(DEADCODE) dead_error_line: Execution cannot reach this statement:
if (pretty->use_colors) {
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 15 Aug 2017 21:10:26 +0000 (17:10 -0400)]
Cleanup: no need to check for NULL before g_free
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 15 Jun 2017 18:46:40 +0000 (14:46 -0400)]
Update Python bindings and tests to match the latest API
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 8 Aug 2017 20:37:42 +0000 (16:37 -0400)]
lib/plugin/plugin.c: do not use G_MODULE_BIND_LOCAL for Python plugin provider
Using g_module_open() with the G_MODULE_BIND_LOCAL flag when loading the
Python plugin provider makes it impossible for _native_bt.so (the Python
module, part of the `bt2` package, generated by SWIG) to find libpython
symbols because the Python plugin provider is linked with libpython, not
_native_bt.so.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 4 Aug 2017 23:07:24 +0000 (19:07 -0400)]
Add built-in colander sink component class
You can use this new built-in sink component class to create a component
which passes the consumed notification to the user through a pointer
passed as the initialization method data:
struct bt_notification *notif = NULL;
struct bt_component_class *colander_cc =
bt_component_class_sink_colander_get();
struct bt_component *colander_comp;
ret = bt_graph_add_component_with_init_method_data(graph,
colander_cc, "colander", NULL, ¬if, &colander_comp);
...
for (;;) {
ret = bt_graph_consume(graph);
if (ret != BT_GRAPH_STATUS_OK) {
...
}
/* Do something with notif */
BT_PUT(notif);
}
Everytime you call bt_graph_consume() and this function is successful,
your notification pointer contains a reference to the consumed
notification. You need to release this reference with bt_put(), as the
colander component won't do it. This is why you should not use
bt_graph_run() with a colander component because notifications will
leak.
bt_component_class_sink_colander_get() lazily creates the component
class the first time it is called and the uses this same reference for
future calls. The source file's destructor releases the global reference
when the library is destroyed.
The component class is built-in so that you do not need any installed
plugins to use this utility. Since it's not part of a plugin, you cannot
use it with the CLI, but this is okay because it needs custom
initialization method data anyway.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 4 Aug 2017 23:05:49 +0000 (19:05 -0400)]
Remove include of <babeltrace-internal.h> from public headers
notification-heap.h is not using anything in babeltrace-internal.h,
while plugin-dev.h only uses BT_HIDDEN, which is now part of the file
itself as _BT_HIDDEN.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 4 Aug 2017 23:04:39 +0000 (19:04 -0400)]
tests/lib/test-plugin-plugins/minimal.c: add missing <glib.h> include
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 4 Aug 2017 23:04:19 +0000 (19:04 -0400)]
cli/babeltrace-log.c: include <string.h> for strdup()
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 4 Aug 2017 21:42:03 +0000 (17:42 -0400)]
graph: check if graph has at least one sink to return the NO_SINK status
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 3 Aug 2017 20:34:10 +0000 (16:34 -0400)]
Fix: CC prio. map. leak in event notification
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 3 Aug 2017 20:33:39 +0000 (16:33 -0400)]
lib: do not finalize a non-initialized notification iterator
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 26 Jul 2017 20:45:07 +0000 (16:45 -0400)]
Fix: cli: Coverity issue: no need to check `status`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 26 Jul 2017 19:58:37 +0000 (15:58 -0400)]
bt_ctf_clock_value_create(): freeze clock class
This is how other classes in the library work: when you instantiate a
class as a value (here a clock class as a clock value), the class is
frozen.
This patch does not seem to break the tests or change anything to the
CLI and plugins, which means all clock classes are already configured
before clock values are created out of them.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 21 Jul 2017 20:34:29 +0000 (16:34 -0400)]
Graph: pass remove listeners when adding listeners
With this patch, when you call bt_graph_add_*_listener(), you can also
provide a "remove listener" which is called when the added listener is
removed when the graph object is destroyed. This is useful when you
dynamically allocate data only for the listener to add and you are not
the only owner of the graph object: the remove listener is where to
free/release this data.
Existing CLIs and tests are modified to match this change.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 21 Jul 2017 20:13:16 +0000 (16:13 -0400)]
ir: trace: pass remove listeners when adding listeners
With this patch, when you call bt_ctf_trace_add_is_static_listener(),
you can also provide a "remove listener" which is called when the added
listener is removed, weither manually with
bt_ctf_trace_remove_is_static_listener(), or when the trace object is
destroyed. This is useful when you dynamically allocate data only for
the listener to add and you are not the only owner of the trace object:
the remove listener is where to free/release this data.
Existing plugins and tests are modified to match and test this change.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 20 Jul 2017 22:30:05 +0000 (18:30 -0400)]
include/babeltrace/graph/private-component.h: add missing `extern`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 17 Jul 2017 20:45:37 +0000 (16:45 -0400)]
Remove bt_notification_discarded_{events,packets}_set_count()
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 17 Jul 2017 20:36:19 +0000 (16:36 -0400)]
bt_notification_inactivity_create(): create an empty CC priority map when NULL
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 17 Jul 2017 19:36:21 +0000 (15:36 -0400)]
bt_notification_event_create(): create an empty CC priority map when NULL
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 17 Jul 2017 03:15:22 +0000 (23:15 -0400)]
lib: move bt_notification_iterator_next_return to component-class.h
This type is the return type of a callback which is part of a component
class definition (to define an implicit notification iterator class).
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 17 Jul 2017 00:51:02 +0000 (20:51 -0400)]
lib: use `enum bt_port_status` where possible
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 14 Jun 2017 21:47:40 +0000 (17:47 -0400)]
Remove unused bt_port_remove_from_component()
This public version should not exist. Only the parent component can
remove one of its port with bt_private_port_remove_from_component().
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 10 Aug 2017 19:24:20 +0000 (15:24 -0400)]
Update .gitignore to add newly generated test files
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Tue, 8 Aug 2017 20:02:35 +0000 (16:02 -0400)]
Re-enable the bin-info and dward tests
During the development of the debug-info plugin, the old tests were
disabled. Re-adapt them to the new tree and re-enable them in the test
suite.
Reported-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Tue, 8 Aug 2017 19:19:12 +0000 (15:19 -0400)]
Port: Add glib checks for cross compilation
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 3 Aug 2017 18:52:27 +0000 (14:52 -0400)]
Fix: ctf-testsuite variant-missing-fields
It is valid for an enumeration to contain labels that are missing in the
variant fields. For instance, an enumeration can be used for many
purposes in addition to being used as a selector for a variant, so we
don't want to enforce that a variant needs to have field names for cases
we never expect as enum field input.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 3 Aug 2017 17:28:36 +0000 (13:28 -0400)]
Fix: fallback on content size if packet size is missing
Fixes ctf-testsuite tests/1.8/regression/pass/2-packets-no-packet-size
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 3 Aug 2017 15:59:37 +0000 (11:59 -0400)]
Fix: unchecked return value of bt_value_array_append_string
CID
1376147 (#1 of 1): Unchecked return value (CHECKED_RETURN).
check_return: Calling bt_value_array_append_string without checking
return value (as is done elsewhere 49 out of 50 times).
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 3 Aug 2017 15:43:18 +0000 (11:43 -0400)]
Fix: tests: offset_s * ns_per_s should not overflow uint64_t
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 3 Aug 2017 15:39:23 +0000 (11:39 -0400)]
Fix: unchecked return value in ctf-writer test
CID
1376151 (#1 of 1): Unchecked return value (CHECKED_RETURN)38.
check_return: Calling bt_ctf_field_type_enumeration_add_mapping_unsigned
without checking return value (as is done elsewhere 7 out of 8 times).
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 3 Aug 2017 14:03:32 +0000 (10:03 -0400)]
Fix: unchecked return value of bt_ctf_field_type_get_field_at_index
CID
1376152 (#1 of 1): Unchecked return value (CHECKED_RETURN).
check_return: Calling bt_ctf_field_type_structure_get_field_by_index
without checking return value (as is done elsewhere 23 out of 25 times).
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 3 Aug 2017 13:59:20 +0000 (09:59 -0400)]
Fix: unchecked return values of bt_value getters
CID
1376153 (#1 of 1): Unchecked return value (CHECKED_RETURN).
check_return: Calling bt_value_bool_get without checking return value
(as is done elsewhere 18 out of 20 times).
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 3 Aug 2017 13:49:22 +0000 (09:49 -0400)]
Fix: unchecked return value of stream flush
Coverity:
CID
1376154 (#1 of 1): Unchecked return value (CHECKED_RETURN)1.
check_return: Calling bt_ctf_stream_flush without checking return value
(as is done elsewhere 5 out of 6 times).
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 3 Aug 2017 13:43:29 +0000 (09:43 -0400)]
Fix: unchecked return value
Found by Coverity:
CID
1376155 (#1 of 1): Unchecked return value (CHECKED_RETURN).
check_return: Calling bt_value_string_get without checking return value
(as is done elsewhere 44 out of 47 times).
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 3 Aug 2017 13:35:12 +0000 (09:35 -0400)]
Fix: remove dead code
Found by Coverity:
notnull: At condition event, the value of event cannot be NULL.
dead_error_condition: The condition event must be true.
CID
1376157 (#1 of 1): Logically dead code (DEADCODE)dead_error_line:
Execution cannot reach the expression NULL inside this statement:
event_class = (event ? bt_g...
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 9 Aug 2017 19:46:47 +0000 (15:46 -0400)]
Fix: wrong variable checked for NULL after allocation
Found by Coverity:
writer_component->base_path = g_string_new(path);
notnull: At condition writer_component, the value of writer_component
cannot be NULL.
dead_error_condition: The condition !writer_component cannot be true.
CID
1376158 (#1 of 1): Logically dead code (DEADCODE)dead_error_begin:
Execution cannot reach this statement: ret = BT_COMPONENT_STATUS_E..
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 9 Aug 2017 19:42:03 +0000 (15:42 -0400)]
Cleanup: dereference after null check
Found by Coverity:
CID
1376165 (#1 of 1): Dereference after null check (FORWARD_NULL)3.
var_deref_op: Dereferencing null pointer v.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 26 Jul 2017 18:09:52 +0000 (14:09 -0400)]
Fix: add missing goto end on error
Found by Coverity:
CID
1376168 (#1 of 1): Dereference after null check (FORWARD_NULL)7.
var_deref_model: Passing null pointer
debug_info_component->arg_debug_info_field_name to sprintf, which
dereferences it.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 26 Jul 2017 18:08:02 +0000 (14:08 -0400)]
Cleanup: remove logically dead code
Found by Coverity:
dead_error_condition: The condition ret ==
BT_NOTIFICATION_ITERATOR_STATUS_OK cannot be true.
206 if (ret == BT_NOTIFICATION_ITERATOR_STATUS_OK) {
CID
1376170 (#1 of 1): Logically dead code (DEADCODE)dead_error_line:
Execution cannot reach this statement: ret = BT_NOTIFICATION_ITERA....
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 26 Jul 2017 18:06:13 +0000 (14:06 -0400)]
Fix: dereference after null check
Found by Coverity:
CID
1376171 (#1 of 1): Dereference after null check (FORWARD_NULL)6.
var_deref_op: Dereferencing null pointer stream.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 26 Jul 2017 17:23:47 +0000 (13:23 -0400)]
Fix: wrong variable in NULL check
Found by Coverity:
notnull: At condition impl_args, the value of impl_args cannot be NULL.
dead_error_condition: The condition !impl_args cannot be true.
CID
1376172 (#1 of 1): Logically dead code (DEADCODE)dead_error_begin:
Execution cannot reach this statement: print_err_oom();.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 26 Jul 2017 17:21:43 +0000 (13:21 -0400)]
Cleanup: remove logically dead code
Found by Coverity:
null: At condition fp, the value of fp must be NULL.
dead_error_condition: The condition fp cannot be true.
CID
1376173 (#1 of 1): Logically dead code (DEADCODE)dead_error_begin:
Execution cannot reach this statement: fclose(fp);
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 26 Jul 2017 17:18:01 +0000 (13:18 -0400)]
Cleanup: identical code for different branches
Found by Coverity:
CID
1376174 (#1 of 1): Identical code for different branches
(IDENTICAL_BRANCHES)identical_branches: The same code is executed when
the condition !trimmer is true or false, because the code in the if-then
branch and after the if statement is identical. Should the if statement
be removed?
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 26 Jul 2017 17:14:39 +0000 (13:14 -0400)]
Fix: add missing bound checking in decode_packet
Found by Coverity:
overflow_assign: Assigning overflowed or truncated value (or a value
computed from an overflowed or a truncated value) to toread.
overflow: Subtract operation overflows on operands toread and
readlen. Example values for operands: toread =
268435457, readlen =
9223372037074107386.
overflow_assign: Assigning overflowed or truncated value (or a value
computed from an overflowed or a truncated value) to readlen.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 26 Jul 2017 16:06:53 +0000 (12:06 -0400)]
Fix: Dereference null return value
Found by Coverity:
2. returned_null: bt_ctf_field_type_variant_get_tag_name returns null
(checked 4 out of 5 times).
3. var_assigned: Assigning: pathstr = null return value from
bt_ctf_field_type_variant_get_tag_name.
CID
1376176 (#1 of 1): Dereference null return value (NULL_RETURNS).
dereference: Dereferencing a pointer that might be null pathstr when
calling pathstr_to_field_path.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 26 Jul 2017 16:02:56 +0000 (12:02 -0400)]
Fix: null check after deref, use uninitialized or freed variable
Found by Coverity:
CID
1376179 (#1 of 1): Dereference before null check
(REVERSE_INULL)check_after_deref: Null-checking stream_state suggests
that it may be null, but it has already been dereferenced on all paths
leading to the check.
Reorganized this function so we clear the stream_state (set to NULL)
whenever we return success or error, so the caller don't end up using
uninitialized variable.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 8 Aug 2017 21:35:29 +0000 (17:35 -0400)]
Cleanup: missing empty line between functions
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 8 Aug 2017 21:31:51 +0000 (17:31 -0400)]
Use logging macros in src.ctf-fs queries
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 26 Jul 2017 15:55:11 +0000 (11:55 -0400)]
Fix: missing ftell/fseek error handling
Found by Coverity:
CID
1376181 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS).
negative_returns: filesize is passed to a parameter that cannot be
negative.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 26 Jul 2017 15:50:52 +0000 (11:50 -0400)]
Fix: use of file pointer after fclose()
See fclose(3). Further access to out_fp after both success and error,
even through another bt_close_memstream(), results in undefined
behavior. Nullify out_fp to ensure we don't fclose it twice on error.
Found by Coverity:
CID
1376182 (#1 of 1): Use after close (USE_AFTER_FREE).
use_closed_file: Calling bt_close_memstream uses file handle out_fp
after closing it.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 26 Jul 2017 15:40:01 +0000 (11:40 -0400)]
Cleanup: mixing enum types
Found by Coverity:
CID
1376185 (#3 of 3): Inferred misuse of enum (MIXED_ENUMS)mixed_enums:
Mixing enum types enum bt_value_status and enum bt_graph_status for ret.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 24 Jul 2017 22:04:53 +0000 (18:04 -0400)]
Fix: missing check of ftell error
Found by Coverity:
CID
1376186 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)
13. negative_returns: init_pos is passed to a parameter that cannot be
negative.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 24 Jul 2017 22:01:56 +0000 (18:01 -0400)]
Fix: mixed enums used in source.ctf.fs
Found by Coverity:
CID
1376187 (#3 of 3): Inferred misuse of enum (MIXED_ENUMS)
mixed_enums: Mixing enum types enum bt_component_status and enum
bt_value_status for ret.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 24 Jul 2017 21:26:57 +0000 (17:26 -0400)]
Fix: Dereference null return value
Found by Coverity:
3. returned_null: bt_ctf_field_string_get_value returns null (checked 10
out of 12 times).
CID
1376192 (#1 of 1): Dereference null return value (NULL_RETURNS)
4. dereference: Dereferencing a pointer that might be null
bt_ctf_field_string_get_value(field) when calling print_escape_string.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 24 Jul 2017 21:21:17 +0000 (17:21 -0400)]
Fix: assert compared unsigned to 0
Found by Coverity:
CID
1376195 (#1 of 1): Macro compares unsigned to 0 (NO_EFFECT)
unsigned_compare: This greater-than-or-equal-to-zero comparison of an
unsigned value is always true. event_class_id >= 0UL.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 24 Jul 2017 21:15:53 +0000 (17:15 -0400)]
Fix: negative loop bound check
Found by Coverity:
CID
1376197 (#1 of 1): Negative loop bound (NEGATIVE_RETURNS)
3. negative_returns: Using unsigned variable
bt_value_array_size(run_args) in a loop exit condition.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 24 Jul 2017 21:12:35 +0000 (17:12 -0400)]
Fix: resolve.c: enum type mismatch
Found by Coverity:
CID
1376200 (#2 of 2): Inferred misuse of enum (MIXED_ENUMS)
mixed_enums: Mixing enum types enum bt_ctf_field_type_id and enum
ctf_type_id for ctx_cur_field_type_id.
(audited whole file for similar pattern)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 24 Jul 2017 21:00:08 +0000 (17:00 -0400)]
Fix: Explicit null dereferenced
Found by Coverity:
CID
1376244 (#3 of 3): Explicit null dereferenced (FORWARD_NULL)
10. var_deref_op: Dereferencing null pointer node.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Fri, 28 Jul 2017 19:55:11 +0000 (15:55 -0400)]
Standard logging for ctf.fs sink
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Fri, 28 Jul 2017 14:01:43 +0000 (10:01 -0400)]
Standard logging for libctfcopytrace
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Thu, 27 Jul 2017 19:20:21 +0000 (15:20 -0400)]
Standard logging for debug_info plugin
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Thu, 27 Jul 2017 16:07:17 +0000 (12:07 -0400)]
Standard logging for trimmer/copy.c
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 20 Jul 2017 18:53:38 +0000 (14:53 -0400)]
Fix tests: run plugins test wrapper script
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 20 Jul 2017 16:48:47 +0000 (12:48 -0400)]
Fix test: intersection has too large offset_s
The offset_s values multiplied by
1000000000 overflows 64-bit.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Wed, 19 Jul 2017 20:14:59 +0000 (16:14 -0400)]
Tests: only run debug info tests when the feature is enabled
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 13 Jul 2017 15:26:53 +0000 (11:26 -0400)]
Port: Add dummy symbol for macOS linker
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Tue, 11 Jul 2017 15:26:13 +0000 (11:26 -0400)]
Update gitignore
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Mon, 17 Jul 2017 22:21:56 +0000 (18:21 -0400)]
Port: use a separate variable for elfutils libs
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Mon, 17 Jul 2017 21:31:22 +0000 (17:31 -0400)]
Port: built-in plugins support for the macOS linker
The macOS linker requires different options to force link all the
objects in a static archive, detect this at configure.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 13 Jul 2017 19:11:10 +0000 (15:11 -0400)]
Port: 'struct tm' member count vary across platforms
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 13 Jul 2017 19:08:29 +0000 (15:08 -0400)]
Port: Solaris and Cygwin have no sys/syslimits.h
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Tue, 11 Jul 2017 18:48:40 +0000 (14:48 -0400)]
Port: cast result of be64toh() to uint64_t for print format
The type of the return value of be64toh() can vary from unsigned long to
unsigned long long across platforms, cast it to the longer type before
printing.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Tue, 11 Jul 2017 17:38:52 +0000 (13:38 -0400)]
Port: __STRINGIFY exists on Cygwin
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Tue, 11 Jul 2017 16:40:56 +0000 (12:40 -0400)]
Port: Add Solaris tid support to logging
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Tue, 11 Jul 2017 19:58:32 +0000 (15:58 -0400)]
Port: Add Cygwin tid support to logging
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Mon, 10 Jul 2017 16:41:19 +0000 (12:41 -0400)]
Port: unlink() requires unistd.h on Solaris and macOS
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Mon, 10 Jul 2017 16:39:38 +0000 (12:39 -0400)]
Port: handle 'size_t' / 'off_t' on Solaris
The size of 'size_t' / 'off_t' vary on some platforms, use C99 portable
macros and print formats to handle them.
Print 'size_t' with '%zu' and use SIZE_MAX as max value.
Print 'off_t' casted to 'intmax_t' with '%jd'.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Fri, 7 Jul 2017 20:58:48 +0000 (20:58 +0000)]
Port: replace strerror_r() by g_strerror()
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Fri, 7 Jul 2017 20:08:23 +0000 (20:08 +0000)]
Port: replace opendir() by g_dir_open()
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Tue, 13 Jun 2017 20:10:17 +0000 (20:10 +0000)]
Port: replace setenv() by g_setenv()
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Tue, 18 Jul 2017 15:08:44 +0000 (11:08 -0400)]
Fix: append to LIBS, don't override it
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Wed, 12 Jul 2017 19:15:14 +0000 (15:15 -0400)]
Port: do not include malloc.h
malloc.h does not exists on all platforms and is included by stdlib.h
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 18 Jul 2017 23:44:43 +0000 (19:44 -0400)]
Fix: visit_event_decl(): always set stream_id variable
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Wed, 12 Jul 2017 20:23:11 +0000 (16:23 -0400)]
Fix: don't store an int64_t value in a ptr
The key of the stream_classes GHashTable was a int64_t stored directly
in a pointer which works only on 64bits platform. Instead, allocate a
int64_t value and use a pointer to it as the key.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Wed, 12 Jul 2017 19:14:54 +0000 (15:14 -0400)]
Fix: use extern for variables instead of BT_HIDDEN
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Fri, 7 Jul 2017 20:59:13 +0000 (20:59 +0000)]
Fix: logging in socket-internal.h
Log statements in static inline functions must be ifdefed.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Fri, 14 Jul 2017 18:50:31 +0000 (14:50 -0400)]
Fix: remove g_ptr_array_insert to keep glib 2.22 compat
closes #1120
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Mon, 10 Jul 2017 16:36:50 +0000 (12:36 -0400)]
Fix: g_hash_table_insert returns 'void' in glib <= 2.39.2
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Mon, 10 Jul 2017 15:55:20 +0000 (11:55 -0400)]
Fix: G_SPAWN_DEFAULT was introduced in glib 2.37.6
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 17 Jul 2017 19:30:29 +0000 (15:30 -0400)]
Pretty plugin: only print negative timestamp warning once per component
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 17 Jul 2017 19:26:07 +0000 (15:26 -0400)]
Fix test: packet seq num has too large offset_s
The offset_s values multiplied by
1000000000 overflows 64-bit.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 13 Jul 2017 21:16:09 +0000 (17:16 -0400)]
ctf: visitor-generate-ir: accept negative clock offsets
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.043825 seconds and 4 git commands to generate.