This change ensures that ctf_move_pos() does not create a new packet when ctf_move_pos() moves out of the current packet's bounds. The next call to ctf_pos_access_ok() will report EFAULT which can then be handled appropriately by the caller.
Signed-off-by: Jérémie Galarneau <[email protected]> Reviewed-by: Mathieu Desnoyers <[email protected]> --- include/babeltrace/ctf/types.h | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/include/babeltrace/ctf/types.h b/include/babeltrace/ctf/types.h index 715cdbd..96c5083 100644 --- a/include/babeltrace/ctf/types.h +++ b/include/babeltrace/ctf/types.h @@ -137,23 +137,6 @@ void ctf_move_pos(struct ctf_stream_pos *pos, uint64_t bit_offset) if (unlikely(pos->offset == EOF)) return; - if (pos->fd >= 0) { - /* - * PROT_READ ctf_packet_seek is called from within - * ctf_pos_get_event so end of packet does not change - * the packet context on for the last event of the - * packet. - */ - if ((pos->prot == PROT_WRITE) - && (unlikely(pos->offset + bit_offset >= pos->packet_size))) { - printf_debug("ctf_packet_seek (before call): %" PRId64 "\n", - pos->offset); - ctf_packet_seek(&pos->parent, 0, SEEK_CUR); - printf_debug("ctf_packet_seek (after call): %" PRId64 "\n", - pos->offset); - return; - } - } pos->offset += bit_offset; printf_debug("ctf_move_pos after increment: %" PRId64 "\n", pos->offset); } @@ -201,7 +184,7 @@ int ctf_pos_packet(struct ctf_stream_pos *dummy) static inline void ctf_pos_pad_packet(struct ctf_stream_pos *pos) { - ctf_move_pos(pos, pos->packet_size - pos->offset); + ctf_packet_seek(&pos->parent, 0, SEEK_CUR); } static inline -- 1.8.4 _______________________________________________ lttng-dev mailing list [email protected] http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
