From a941822d1c00f0275f0f1b5ef96d4c533b63c8de Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Tue, 27 May 2025 14:25:12 +0200 Subject: [PATCH] cgroup-util: assert on attribute for cg_{get,set}_attribute() It makes zero sense to ever perform IO operations on cgroup dirs. --- src/basic/cgroup-util.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c index c70b04650c1..f3ce1742448 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c @@ -1594,6 +1594,8 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri _cleanup_free_ char *p = NULL; int r; + assert(attribute); + r = cg_get_path(controller, path, attribute, &p); if (r < 0) return r; @@ -1605,6 +1607,8 @@ int cg_get_attribute(const char *controller, const char *path, const char *attri _cleanup_free_ char *p = NULL; int r; + assert(attribute); + r = cg_get_path(controller, path, attribute, &p); if (r < 0) return r; -- 2.47.3