mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-07 17:17:44 +03:00
bus: align the buffer we pass to the kernel
This commit is contained in:
parent
1b9abbf0d8
commit
8e7382422c
@ -109,7 +109,7 @@ static int bus_message_setup_kmsg(sd_bus_message *m) {
|
|||||||
sz += ALIGN8(offsetof(struct kdbus_msg, data) + dl + 1);
|
sz += ALIGN8(offsetof(struct kdbus_msg, data) + dl + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
m->kdbus = malloc0(sz);
|
m->kdbus = aligned_alloc(8, sz);
|
||||||
if (!m->kdbus)
|
if (!m->kdbus)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
@ -355,10 +355,11 @@ int bus_kernel_read_message(sd_bus *bus, sd_bus_message **m) {
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
void *q;
|
void *q;
|
||||||
|
|
||||||
q = realloc(bus->rbuffer, sz);
|
q = aligned_alloc(8, sz);
|
||||||
if (!q)
|
if (!q)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
|
free(bus->rbuffer);
|
||||||
k = bus->rbuffer = q;
|
k = bus->rbuffer = q;
|
||||||
k->size = sz;
|
k->size = sz;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user