]> git.ipfire.org Git - thirdparty/lxc.git/commit
cgroups: fix "uninitialized transient_len" warning 3347/head
authorAleksa Sarai <cyphar@cyphar.com>
Thu, 2 Apr 2020 08:15:11 +0000 (19:15 +1100)
committerAleksa Sarai <cyphar@cyphar.com>
Thu, 2 Apr 2020 08:18:41 +0000 (19:18 +1100)
commit346830421a968c41e3198ca64ab3f7217075e491
treeb6e5b13d5cb9fcad37443034c954c40be71ab55b
parent5f2ed0c09f9966983042dfeb546824def694a7fb
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>
src/lxc/cgroups/cgfsng.c