]> git.lttng.org Git - lttng-tools.git/commitdiff
Fix: consumer snapshot: handle unsigned long overflow
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 19 Feb 2019 22:47:49 +0000 (17:47 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 29 Mar 2019 15:51:47 +0000 (11:51 -0400)
Comparing the consumed iterator and the produced position without
using a difference generates an empty snapshot when the iterator is
before unsigned long overflow and the produced position is after
unsigned long overflow.

This applies to both UST and kernel consumers.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/kernel-consumer/kernel-consumer.c
src/common/ust-consumer/ust-consumer.c

index d82e07fcaacf147cf4d59d8e98119cc3adc326bf..d44ee6a7d67fd79bd613ed6502db5145ce46e35a 100644 (file)
@@ -240,7 +240,7 @@ int lttng_kconsumer_snapshot_channel(uint64_t key, char *path,
                                produced_pos, nb_packets_per_stream,
                                stream->max_sb_size);
 
-               while (consumed_pos < produced_pos) {
+               while ((long) (consumed_pos - produced_pos) < 0) {
                        ssize_t read_len;
                        unsigned long len, padded_len;
 
index 3d3a30dcd9e2e41d47b7c8d2bc7a92edbce57b35..cc77739ce301c0954c59d2a7437126e5829061f9 100644 (file)
@@ -1174,7 +1174,7 @@ static int snapshot_channel(uint64_t key, char *path, uint64_t relayd_id,
                                produced_pos, nb_packets_per_stream,
                                stream->max_sb_size);
 
-               while (consumed_pos < produced_pos) {
+               while ((long) (consumed_pos - produced_pos) < 0) {
                        ssize_t read_len;
                        unsigned long len, padded_len;
 
This page took 0.0320859999999999 seconds and 4 git commands to generate.