mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-15 04:09:46 +00:00
cgroups: fix "uninitialized transient_len" warning
Without this change, a build error is triggered if you compile with -Werror=maybe-uninitialized. cgroups/cgfsng.c: In function 'cgfsng_monitor_enter': groups/cgfsng.c:1387:9: error: 'transient_len' may be used uninitialized in this function ret = lxc_writeat(h->cgfd_mon, "cgroup.procs", transient, transient_len); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The issue is that if handler->transient_pid is 0, then transient_len is uninitialised but lxc_writeat(..., transient_len) still gets called. Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
This commit is contained in:
parent
5f2ed0c09f
commit
346830421a
@ -1388,7 +1388,7 @@ __cgfsng_ops static bool cgfsng_monitor_enter(struct cgroup_ops *ops,
|
|||||||
if (ret)
|
if (ret)
|
||||||
return log_error_errno(false, errno, "Failed to enter cgroup \"%s\"", h->monitor_full_path);
|
return log_error_errno(false, errno, "Failed to enter cgroup \"%s\"", h->monitor_full_path);
|
||||||
|
|
||||||
if (handler->transient_pid < 0)
|
if (handler->transient_pid <= 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
ret = lxc_writeat(h->cgfd_mon, "cgroup.procs", transient, transient_len);
|
ret = lxc_writeat(h->cgfd_mon, "cgroup.procs", transient, transient_len);
|
||||||
|
Loading…
Reference in New Issue
Block a user