Coverity doesn't like the fact that unit_get_cgroup_context() returns NULL for
unit types that don't have a CGroupContext. We don't expect to call those
functions with such unit types, so this isn't an immediate problem, but we can
make things more robust by handling this case.
CID #
1400683, #
1400684.
assert(u); \
\
c = unit_get_cgroup_context(u); \
- \
- if (c->entry##_set) \
+ if (c && c->entry##_set) \
return c->entry; \
\
- while (UNIT_ISSET(u->slice)) { \
- u = UNIT_DEREF(u->slice); \
+ while ((u = UNIT_DEREF(u->slice))) { \
c = unit_get_cgroup_context(u); \
- \
- if (c->default_##entry##_set) \
+ if (c && c->default_##entry##_set) \
return c->default_##entry; \
} \
\