diff options
author | Michal Sekletar <msekletar@users.noreply.github.com> | 2019-05-31 15:23:23 +0200 |
---|---|---|
committer | The Plumber <50238977+systemd-rhel-bot@users.noreply.github.com> | 2020-11-02 16:03:44 +0100 |
commit | 1730f7bb306e13689a7684fd93ae5b8383a28d2f (patch) | |
tree | bb85f08a8bc685a6b7cba58adf8a6454e0d0552c | |
parent | 1c8d1c3bbdf8bdfb2ee4f85b9f559f54c6e4cac4 (diff) | |
download | systemd-1730f7bb306e13689a7684fd93ae5b8383a28d2f.tar.gz |
dbus-execute: make transfer of CPUAffinity endian safe (#12711)
We store the affinity mask in the native endian. However, over D-Bus we
must transfer the mask in little endian byte order.
This is the second part of c367f996f5f091a63f812f0140b304c649be77fc.
(cherry picked from commit 75e40119a471454516ad0acc96f6f4094e7fb652)
Related: #1740657
-rw-r--r-- | src/core/dbus-execute.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c index f9527e56b2..d5acca384f 100644 --- a/src/core/dbus-execute.c +++ b/src/core/dbus-execute.c @@ -215,12 +215,15 @@ static int property_get_cpu_affinity( sd_bus_error *error) { ExecContext *c = userdata; + _cleanup_free_ uint8_t *array = NULL; + size_t allocated; assert(bus); assert(reply); assert(c); - return sd_bus_message_append_array(reply, 'y', c->cpu_set.set, c->cpu_set.allocated); + (void) cpu_set_to_dbus(&c->cpu_set, &array, &allocated); + return sd_bus_message_append_array(reply, 'y', array, allocated); } static int property_get_numa_mask( |