]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
tools/cgset: fix Uninitialized pointer read
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Fri, 17 Feb 2023 09:59:30 +0000 (09:59 +0000)
committerTom Hromatka <tom.hromatka@oracle.com>
Fri, 17 Feb 2023 15:06:11 +0000 (08:06 -0700)
commit94ba8b65f8b3424232cf3fea5a06fbbfb921789a
tree1f69ac6ad8210847e943a86bdc514f8127643606
parent4611135a0672ba2bb2b275cd71e57873da4ec293
tools/cgset: fix Uninitialized pointer read

Fix Uninitialized pointer read, reported by Coverity Tool:

CID 307779 (#2 of 2): Uninitialized pointer read (UNINIT)22.
uninit_use_in_call: Using uninitialized value src_cgroup when calling
cgroup_free.

In main(), src_cgrp points to a valid struct cgroup only when the
user calls cgxset using --copy-from flag, Coverity warns about the
freeing src_cgrp, which is uninitialized in the error path.  This patch
initializes converted_src_cgroup, src_cgroup and cgroup uninitialized
pointers and checks is src_cgrp is valid pointer before passing it to
cgroup_free()

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