lttng-ctl rotate: fix: possible unaligned access in packed structure
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 14 Sep 2019 18:38:44 +0000 (14:38 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 14 Sep 2019 20:33:48 +0000 (16:33 -0400)
Fix the warnings that unaligned pointers can be passed as parameters
emitted when sampling rotation schedules.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/lib/lttng-ctl/rotate.c

index 446b332e41354599a18b2967f85a33456b9b0faf..bc3a63cc8aa67d8a0bd089e32b56677d0795039f 100644 (file)
@@ -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;
        }
This page took 0.026536 seconds and 4 git commands to generate.