From: Kamalesh Babulal Date: Fri, 20 May 2022 14:45:16 +0000 (-0600) Subject: tools/cgxset: fix Coverity uninitialized variable warning X-Git-Tag: v3.0~74 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c71e1446e7ccd88af803e65999bc46ae2fec3a63;p=thirdparty%2Flibcgroup.git tools/cgxset: fix Coverity uninitialized variable warning 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 Signed-off-by: Tom Hromatka --- diff --git a/src/tools/cgxset.c b/src/tools/cgxset.c index 9eb2d8a2..27cec2f6 100644 --- a/src/tools/cgxset.c +++ b/src/tools/cgxset.c @@ -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;