Fix the following clang warning by explicitily initializing disk_cg to
NULL.
tools/cgxget.c:903:6: warning: variable 'disk_cg' is used uninitialized
whenever 'if' condition is true [-Wsometimes-uninitialized]
903 | if (!cg || !(*cg)) {
| ^~~~~~~~~~~~~
tools/cgxget.c:940:6: note: uninitialized use occurs here
940 | if (disk_cg)
| ^~~~~~~
tools/cgxget.c:903:2: note: remove the 'if' if its condition is always
false
903 | if (!cg || !(*cg)) {
| ^~~~~~~~~~~~~~~~~~~~
904 | ret = ECGINVAL;
| ~~~~~~~~~~~~~~~
905 | goto out;
| ~~~~~~~~~
906 | }
| ~
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
#ifdef LIBCG_LIB
int cgroup_cgxget(struct cgroup **cg, enum cg_version_t version, bool ignore_unmappable)
{
- struct cgroup *disk_cg, *out_cg;
+ struct cgroup *disk_cg = NULL, *out_cg;
int ret;
if (!cg || !(*cg)) {