]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/dbus-execute: propagate oom in property_get_cpu_affinity
authorZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Mon, 18 May 2026 10:29:12 +0000 (12:29 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Mon, 18 May 2026 10:29:12 +0000 (12:29 +0200)
The function already returns errors, so I'm not sure why we ignored
the error in the second call, potentially leaving variables unitialized.
It seems easiest to propagate the error.

Reported by qarmin (Rafał Mikrut).

src/core/dbus-execute.c

index 906002570f1e8959988b7ca8d00c6b5dceb0ea91..4d86c07a41a43be36f83303ea24907c57169829b 100644 (file)
@@ -123,19 +123,20 @@ static int property_get_cpu_affinity(
         _cleanup_(cpu_set_done) CPUSet s = {};
         _cleanup_free_ uint8_t *array = NULL;
         size_t allocated;
+        int r;
 
         assert(bus);
         assert(reply);
 
         if (c->cpu_affinity_from_numa) {
-                int r;
-
                 r = numa_to_cpu_set(&c->numa_policy, &s);
                 if (r < 0)
                         return r;
         }
 
-        (void) cpu_set_to_dbus(c->cpu_affinity_from_numa ? &s : &c->cpu_set,  &array, &allocated);
+        r = cpu_set_to_dbus(c->cpu_affinity_from_numa ? &s : &c->cpu_set, &array, &allocated);
+        if (r < 0)
+                return r;
 
         return sd_bus_message_append_array(reply, 'y', array, allocated);
 }