summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libsystemd-bus/bus-internal.c1
-rw-r--r--src/libsystemd-bus/bus-kernel.c8
-rw-r--r--src/shared/macro.h2
3 files changed, 8 insertions, 3 deletions
diff --git a/src/libsystemd-bus/bus-internal.c b/src/libsystemd-bus/bus-internal.c
index 317f6a8a9c..df295539ac 100644
--- a/src/libsystemd-bus/bus-internal.c
+++ b/src/libsystemd-bus/bus-internal.c
@@ -141,7 +141,6 @@ bool service_name_is_valid(const char *p) {
return false;
return true;
-
}
bool member_name_is_valid(const char *p) {
diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c
index dc6f5b9985..878cd9c432 100644
--- a/src/libsystemd-bus/bus-kernel.c
+++ b/src/libsystemd-bus/bus-kernel.c
@@ -57,23 +57,27 @@ static void append_payload_vec(struct kdbus_msg_data **d, const void *p, size_t
assert(p);
assert(sz > 0);
+ *d = ALIGN8_PTR(*d);
+
(*d)->size = offsetof(struct kdbus_msg_data, vec) + sizeof(struct kdbus_vec);
(*d)->type = KDBUS_MSG_PAYLOAD_VEC;
(*d)->vec.address = (uint64_t) p;
(*d)->vec.size = sz;
- *d = (struct kdbus_msg_data*) ((uint8_t*) *d + ALIGN8((*d)->size));
+ *d = (struct kdbus_msg_data*) ((uint8_t*) *d + (*d)->size);
}
static void append_destination(struct kdbus_msg_data **d, const char *s, size_t length) {
assert(d);
assert(d);
+ *d = ALIGN8_PTR(*d);
+
(*d)->size = offsetof(struct kdbus_msg_data, str) + length + 1;
(*d)->type = KDBUS_MSG_DST_NAME;
memcpy((*d)->str, s, length + 1);
- *d = (struct kdbus_msg_data*) ((uint8_t*) *d + ALIGN8((*d)->size));
+ *d = (struct kdbus_msg_data*) ((uint8_t*) *d + (*d)->size);
}
static int bus_message_setup_kmsg(sd_bus_message *m) {
diff --git a/src/shared/macro.h b/src/shared/macro.h
index 84a453a8f2..99dc733853 100644
--- a/src/shared/macro.h
+++ b/src/shared/macro.h
@@ -65,6 +65,8 @@
#error "Wut? Pointers are neither 4 nor 8 bytes long?"
#endif
+#define ALIGN8_PTR(p) ((void*) ALIGN8((unsigned long) p))
+
static inline size_t ALIGN_TO(size_t l, size_t ali) {
return ((l + ali - 1) & ~(ali - 1));
}