]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
tools/cgxset: fix Coverity uninitialized variable warning
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Fri, 20 May 2022 14:45:16 +0000 (08:45 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Fri, 20 May 2022 14:45:21 +0000 (08:45 -0600)
Originally this issue got reported on tools/cgset and since tools/cgxset
borrows most of the code from cgset, fix the issue here too.  The
original warning (cgset):

CID 1488715 (#1 of 1): Uninitialized scalar variable (UNINIT).
uninit_use_in_call: Using uninitialized value *src_cg_path as
argument to %s when calling fprintf.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/tools/cgxset.c

index 9eb2d8a29a6e1c84b2ac39d11a9ef753d0238dc8..27cec2f630b779f5368453238c90183f5a7f5f52 100644 (file)
@@ -148,7 +148,7 @@ int main(int argc, char *argv[])
        int nv_max = 0;
 
        struct cgroup *converted_src_cgroup;
-       char src_cg_path[FILENAME_MAX];
+       char src_cg_path[FILENAME_MAX] = "\0";
        struct cgroup *src_cgroup;
        struct cgroup *cgroup;