Fixed findings

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-775): [#def1]
crun-1.17-build/crun-HEAD/src/libcrun/cgroup-resources.c: scope_hint: In function 'update_cgroup_v1_resources'
crun-1.17-build/crun-HEAD/src/libcrun/cgroup-resources.c:1085:21: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(path_to_blkio, 2686976)'
# 1083|           return ret;
# 1084|   
# 1085|->       dirfd_blkio = open (path_to_blkio, O_DIRECTORY | O_PATH | O_CLOEXEC);
# 1086|         if (UNLIKELY (dirfd_blkio < 0))
# 1087|           return crun_make_error (err, errno, "open `%s`", path_to_blkio);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def2]
crun-1.17-build/crun-HEAD/src/libcrun/cgroup-resources.c:1110:24: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(path_to_netclass, 2686976)'
# 1108|           return ret;
# 1109|   
# 1110|->       dirfd_netclass = open (path_to_netclass, O_DIRECTORY | O_PATH | O_CLOEXEC);
# 1111|         if (UNLIKELY (dirfd_netclass < 0))
# 1112|           return crun_make_error (err, errno, "open `%s`", path_to_netclass);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def3]
crun-1.17-build/crun-HEAD/src/libcrun/cgroup-resources.c:1114:23: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(path_to_netprio, 2686976)'
# 1112|           return crun_make_error (err, errno, "open `%s`", path_to_netclass);
# 1113|   
# 1114|->       dirfd_netprio = open (path_to_netprio, O_DIRECTORY | O_PATH | O_CLOEXEC);
# 1115|         if (UNLIKELY (dirfd_netprio < 0))
# 1116|           return crun_make_error (err, errno, "open `%s`", path_to_netprio);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def4]
crun-1.17-build/crun-HEAD/src/libcrun/cgroup-resources.c:1131:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(path_to_htlb, 2686976)'
# 1129|         if (UNLIKELY (ret < 0))
# 1130|           return ret;
# 1131|->       dirfd_htlb = open (path_to_htlb, O_DIRECTORY | O_PATH | O_CLOEXEC);
# 1132|         if (UNLIKELY (dirfd_htlb < 0))
# 1133|           return crun_make_error (err, errno, "open `%s`", path_to_htlb);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def5]
crun-1.17-build/crun-HEAD/src/libcrun/cgroup-resources.c:1150:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(path_to_devs, 589824)'
# 1148|           return ret;
# 1149|   
# 1150|->       dirfd_devs = open (path_to_devs, O_DIRECTORY | O_RDONLY | O_CLOEXEC);
# 1151|         if (UNLIKELY (dirfd_devs < 0))
# 1152|           return crun_make_error (err, errno, "open `%s`", path_to_devs);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def6]
crun-1.17-build/crun-HEAD/src/libcrun/cgroup-systemd.c: scope_hint: In function 'get_cgroup_scope_path'
crun-1.17-build/crun-HEAD/src/libcrun/cgroup-systemd.c:1685:9: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected
crun-1.17-build/crun-HEAD/src/libcrun/cgroup-internal.h:22: included_from: Included from here.
crun-1.17-build/crun-HEAD/src/libcrun/cgroup-systemd.c:23: included_from: Included from here.
<built-in>: note: argument 1 of '__builtin_strchr' must be non-null
# 1683|     path_to_scope = xstrdup (cgroup_path);
# 1684|   
# 1685|->   cur = strchr (path_to_scope, '/');
# 1686|     while (cur)
# 1687|       {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
crun-1.17-build/crun-HEAD/src/libcrun/cgroup-systemd.c: scope_hint: In function 'libcrun_destroy_cgroup_systemd'
crun-1.17-build/crun-HEAD/src/libcrun/cgroup-systemd.c:1686:10: warning[-Wanalyzer-malloc-leak]: leak of 'get_cgroup_scope_path(*cgroup_status.path, *cgroup_status.scope)'
# 1684|   
# 1685|     cur = strchr (path_to_scope, '/');
# 1686|->   while (cur)
# 1687|       {
# 1688|         char *next = strchr (cur + 1, '/');

Error: GCC_ANALYZER_WARNING (CWE-401): [#def8]
crun-1.17-build/crun-HEAD/src/libcrun/cgroup-systemd.c:1688:32: warning[-Wanalyzer-malloc-leak]: leak of 'get_cgroup_scope_path(*cgroup_status.path, *cgroup_status.scope)'
# 1686|     while (cur)
# 1687|       {
# 1688|->       char *next = strchr (cur + 1, '/');
# 1689|         if (next == NULL)
# 1690|           break;

Error: GCC_ANALYZER_WARNING (CWE-1341): [#def9]
crun-1.17-build/crun-HEAD/src/libcrun/utils.h:105:25: warning[-Wanalyzer-fd-double-close]: double 'close' of file descriptor 'dirfd_htlb'
crun-1.17-build/crun-HEAD/src/libcrun/utils.h: scope_hint: In function 'cleanup_closep.part.0'
#  103|     int *pp = (int *) p;
#  104|     if (*pp >= 0)
#  105|->     TEMP_FAILURE_RETRY (close (*pp));
#  106|   }
#  107|   

Error: GCC_ANALYZER_WARNING (CWE-1341): [#def10]
crun-1.17-build/crun-HEAD/src/libcrun/utils.h:105:25: warning[-Wanalyzer-fd-double-close]: double 'close' of file descriptor 'dirfd_netclass'
crun-1.17-build/crun-HEAD/src/libcrun/utils.h: scope_hint: In function 'cleanup_closep.part.0'
#  103|     int *pp = (int *) p;
#  104|     if (*pp >= 0)
#  105|->     TEMP_FAILURE_RETRY (close (*pp));
#  106|   }
#  107|   

Error: GCC_ANALYZER_WARNING (CWE-1341): [#def11]
crun-1.17-build/crun-HEAD/src/libcrun/utils.h:105:25: warning[-Wanalyzer-fd-double-close]: double 'close' of file descriptor 'dirfd_netprio'
crun-1.17-build/crun-HEAD/src/libcrun/utils.h: scope_hint: In function 'cleanup_closep.part.0'
#  103|     int *pp = (int *) p;
#  104|     if (*pp >= 0)
#  105|->     TEMP_FAILURE_RETRY (close (*pp));
#  106|   }
#  107|   

Scan Properties

analyzer-version-clippy1.81.0
analyzer-version-cppcheck2.15.0
analyzer-version-gcc14.2.1
analyzer-version-gcc-analyzer14.2.1
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.81.0
diffbase-analyzer-version-cppcheck2.15.0
diffbase-analyzer-version-gcc14.2.1
diffbase-analyzer-version-gcc-analyzer14.2.1
diffbase-analyzer-version-shellcheck0.10.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-161.us-west-2.compute.internal
diffbase-mock-configfedora-rawhide-x86_64
diffbase-project-namecrun-1.17-1.20241018150928159111.pr1579.39.g7d24aa3
diffbase-store-results-to/tmp/tmp2kb6fl5l/crun-1.17-1.20241018150928159111.pr1579.39.g7d24aa3.tar.xz
diffbase-time-created2024-10-18 15:21:25
diffbase-time-finished2024-10-18 15:27:20
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,clippy,cppcheck,shellcheck,unicontrol' '-o' '/tmp/tmp2kb6fl5l/crun-1.17-1.20241018150928159111.pr1579.39.g7d24aa3.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '/tmp/tmp2kb6fl5l/crun-1.17-1.20241018150928159111.pr1579.39.g7d24aa3.src.rpm'
diffbase-tool-versioncsmock-3.7.1-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-161.us-west-2.compute.internal
mock-configfedora-rawhide-x86_64
project-namecrun-1.17-1.20241017161755151809.main.33.ge9c9294
store-results-to/tmp/tmpqluafmgv/crun-1.17-1.20241017161755151809.main.33.ge9c9294.tar.xz
time-created2024-10-18 15:14:55
time-finished2024-10-18 15:20:54
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,clippy,cppcheck,shellcheck,unicontrol' '-o' '/tmp/tmpqluafmgv/crun-1.17-1.20241017161755151809.main.33.ge9c9294.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '/tmp/tmpqluafmgv/crun-1.17-1.20241017161755151809.main.33.ge9c9294.src.rpm'
tool-versioncsmock-3.7.1-1.el9