From 7370c9557408fc19f87958c204a51b6342f24208 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Sat, 14 Sep 2019 14:38:44 -0400 Subject: [PATCH] lttng-ctl rotate: fix: possible unaligned access in packed structure MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fix the warnings that unaligned pointers can be passed as parameters emitted when sampling rotation schedules. Signed-off-by: Jérémie Galarneau --- src/lib/lttng-ctl/rotate.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/lib/lttng-ctl/rotate.c b/src/lib/lttng-ctl/rotate.c index 446b332e4..bc3a63cc8 100644 --- a/src/lib/lttng-ctl/rotate.c +++ b/src/lib/lttng-ctl/rotate.c @@ -299,29 +299,33 @@ enum lttng_rotation_status lttng_rotation_update_schedule( switch (schedule->type) { case LTTNG_ROTATION_SCHEDULE_TYPE_SIZE_THRESHOLD: { + uint64_t threshold; + status = lttng_rotation_schedule_size_threshold_get_threshold( - schedule, &lsm.u.rotation_set_schedule.value); + schedule, &threshold); if (status != LTTNG_ROTATION_STATUS_OK) { if (status == LTTNG_ROTATION_STATUS_UNAVAILABLE) { status = LTTNG_ROTATION_STATUS_INVALID; } goto end; } - + lsm.u.rotation_set_schedule.value = threshold; lsm.u.rotation_set_schedule.set = !!add; break; } case LTTNG_ROTATION_SCHEDULE_TYPE_PERIODIC: { + uint64_t period; + status = lttng_rotation_schedule_periodic_get_period( - schedule, &lsm.u.rotation_set_schedule.value); + schedule, &period); if (status != LTTNG_ROTATION_STATUS_OK) { if (status == LTTNG_ROTATION_STATUS_UNAVAILABLE) { status = LTTNG_ROTATION_STATUS_INVALID; } goto end; } - + lsm.u.rotation_set_schedule.value = period; lsm.u.rotation_set_schedule.set = !!add; break; } -- 2.34.1