From: Jérémie Galarneau Date: Sat, 14 Sep 2019 18:38:44 +0000 (-0400) Subject: lttng-ctl rotate: fix: possible unaligned access in packed structure X-Git-Tag: v2.12.0-rc1~387 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=7370c9557408fc19f87958c204a51b6342f24208;p=lttng-tools.git lttng-ctl rotate: fix: possible unaligned access in packed structure Fix the warnings that unaligned pointers can be passed as parameters emitted when sampling rotation schedules. Signed-off-by: Jérémie Galarneau --- 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; }