Fixed findings

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-775): [#def1]
crun-1.17-build/crun-1.17/src/libcrun/cgroup-systemd.c: scope_hint: In function 'setup_cpuset_for_systemd_v1'
crun-1.17-build/crun-1.17/src/libcrun/cgroup-systemd.c:269:22: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(path_to_cpuset, 2686976)'
crun-1.17-build/crun-1.17/src/libcrun/cgroup-systemd.c: scope_hint: In function 'setup_cpuset_for_systemd_v1'
crun-1.17-build/crun-1.17/src/libcrun/cgroup-systemd.c: scope_hint: In function 'setup_cpuset_for_systemd_v1'
#  267|           return ret;
#  268|   
#  269|->       dirfd_cpuset = open (path_to_cpuset, O_DIRECTORY | O_PATH | O_CLOEXEC);
#  270|         if (UNLIKELY (dirfd_cpuset < 0))
#  271|           return crun_make_error (err, errno, "open `%s`", path_to_cpuset);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def2]
crun-1.17-build/crun-1.17/src/libcrun/cgroup-systemd.c: scope_hint: In function ‘setup_cpuset_for_systemd_v1’
crun-1.17-build/crun-1.17/src/libcrun/cgroup-systemd.c:269:22: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(path_to_cpuset, 2686976)’
crun-1.17-build/crun-1.17/src/libcrun/cgroup-systemd.c: scope_hint: In function ‘setup_cpuset_for_systemd_v1’
crun-1.17-build/crun-1.17/src/libcrun/cgroup-systemd.c: scope_hint: In function ‘setup_cpuset_for_systemd_v1’
#  267|           return ret;
#  268|   
#  269|->       dirfd_cpuset = open (path_to_cpuset, O_DIRECTORY | O_PATH | O_CLOEXEC);
#  270|         if (UNLIKELY (dirfd_cpuset < 0))
#  271|           return crun_make_error (err, errno, "open `%s`", path_to_cpuset);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def3]
crun-1.17-build/crun-1.17/src/libcrun/cgroup-systemd.c: scope_hint: In function ‘get_cgroup_scope_path’
crun-1.17-build/crun-1.17/src/libcrun/cgroup-systemd.c:1314:9: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected
<built-in>: note: argument 1 of ‘__builtin_strchr’ must be non-null
# 1312|     path_to_scope = xstrdup (cgroup_path);
# 1313|   
# 1314|->   cur = strchr (path_to_scope, '/');
# 1315|     while (cur)
# 1316|       {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
crun-1.17-build/crun-1.17/src/libcrun/cgroup-systemd.c: scope_hint: In function 'libcrun_destroy_cgroup_systemd'
crun-1.17-build/crun-1.17/src/libcrun/cgroup-systemd.c:1315:10: warning[-Wanalyzer-malloc-leak]: leak of 'get_cgroup_scope_path(*cgroup_status.path, *cgroup_status.scope)'
# 1313|   
# 1314|     cur = strchr (path_to_scope, '/');
# 1315|->   while (cur)
# 1316|       {
# 1317|         char *next = strchr (cur + 1, '/');

Error: GCC_ANALYZER_WARNING (CWE-401): [#def5]
crun-1.17-build/crun-1.17/src/libcrun/cgroup-systemd.c: scope_hint: In function ‘libcrun_destroy_cgroup_systemd’
crun-1.17-build/crun-1.17/src/libcrun/cgroup-systemd.c:1315:10: warning[-Wanalyzer-malloc-leak]: leak of ‘get_cgroup_scope_path(*cgroup_status.path, *cgroup_status.scope)’
# 1313|   
# 1314|     cur = strchr (path_to_scope, '/');
# 1315|->   while (cur)
# 1316|       {
# 1317|         char *next = strchr (cur + 1, '/');

Error: GCC_ANALYZER_WARNING (CWE-401): [#def6]
crun-1.17-build/crun-1.17/src/libcrun/cgroup-systemd.c:1317:32: warning[-Wanalyzer-malloc-leak]: leak of 'get_cgroup_scope_path(*cgroup_status.path, *cgroup_status.scope)'
# 1315|     while (cur)
# 1316|       {
# 1317|->       char *next = strchr (cur + 1, '/');
# 1318|         if (next == NULL)
# 1319|           break;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
crun-1.17-build/crun-1.17/src/libcrun/cgroup-systemd.c:1317:32: warning[-Wanalyzer-malloc-leak]: leak of ‘get_cgroup_scope_path(*cgroup_status.path, *cgroup_status.scope)’
# 1315|     while (cur)
# 1316|       {
# 1317|->       char *next = strchr (cur + 1, '/');
# 1318|         if (next == NULL)
# 1319|           break;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def8]
crun-1.17-build/crun-1.17/src/libcrun/criu.c:906:32: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(**_134.path, 0)'
crun-1.17-build/crun-1.17/src/libcrun/utils.h:56:40: note: in definition of macro 'UNLIKELY'
crun-1.17-build/crun-1.17/src/libcrun/criu.c:792:17: note: in expansion of macro 'YAJL_IS_ARRAY'
#  904|         if (value == CLONE_NEWNET && def->linux->namespaces[i]->path != NULL)
#  905|           {
#  906|->           inherit_new_net_fd = open (def->linux->namespaces[i]->path, open_flags_for_inherit);
#  907|             if (UNLIKELY (inherit_new_net_fd < 0))
#  908|               return crun_make_error (err, errno, "unable to open(): `%s`", def->linux->namespaces[i]->path);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def9]
crun-1.17-build/crun-1.17/src/libcrun/criu.c:906:32: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(**_134.path, 0)’
crun-1.17-build/crun-1.17/src/libcrun/utils.h:56:40: note: in definition of macro ‘UNLIKELY’
crun-1.17-build/crun-1.17/src/libcrun/criu.c:792:17: note: in expansion of macro ‘YAJL_IS_ARRAY’
#  904|         if (value == CLONE_NEWNET && def->linux->namespaces[i]->path != NULL)
#  905|           {
#  906|->           inherit_new_net_fd = open (def->linux->namespaces[i]->path, open_flags_for_inherit);
#  907|             if (UNLIKELY (inherit_new_net_fd < 0))
#  908|               return crun_make_error (err, errno, "unable to open(): `%s`", def->linux->namespaces[i]->path);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def10]
crun-1.17-build/crun-1.17/src/libcrun/criu.c:915:32: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(**_151.path, 0)'
crun-1.17-build/crun-1.17/src/libcrun/utils.h:56:40: note: in definition of macro 'UNLIKELY'
crun-1.17-build/crun-1.17/src/libcrun/criu.c:792:17: note: in expansion of macro 'YAJL_IS_ARRAY'
#  913|         if (value == CLONE_NEWPID && def->linux->namespaces[i]->path != NULL)
#  914|           {
#  915|->           inherit_new_pid_fd = open (def->linux->namespaces[i]->path, open_flags_for_inherit);
#  916|             if (UNLIKELY (inherit_new_pid_fd < 0))
#  917|               return crun_make_error (err, errno, "unable to open(): `%s`", def->linux->namespaces[i]->path);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def11]
crun-1.17-build/crun-1.17/src/libcrun/criu.c:915:32: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(**_151.path, 0)’
crun-1.17-build/crun-1.17/src/libcrun/utils.h:56:40: note: in definition of macro ‘UNLIKELY’
crun-1.17-build/crun-1.17/src/libcrun/criu.c:792:17: note: in expansion of macro ‘YAJL_IS_ARRAY’
#  913|         if (value == CLONE_NEWPID && def->linux->namespaces[i]->path != NULL)
#  914|           {
#  915|->           inherit_new_pid_fd = open (def->linux->namespaces[i]->path, open_flags_for_inherit);
#  916|             if (UNLIKELY (inherit_new_pid_fd < 0))
#  917|               return crun_make_error (err, errno, "unable to open(): `%s`", def->linux->namespaces[i]->path);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def12]
crun-1.17-build/crun-1.17/src/libcrun/utils.h:62:21: warning[-Wanalyzer-malloc-leak]: leak of 'xmalloc(256)'
crun-1.17-build/crun-1.17/src/libcrun/utils.h:56:40: note: in definition of macro 'UNLIKELY'
crun-1.17-build/crun-1.17/src/libcrun/utils.h:56:40: note: in definition of macro 'UNLIKELY'
#   60|   {
#   61|     void *res = malloc (size);
#   62|->   if (UNLIKELY (res == NULL))
#   63|       OOM ();
#   64|     return res;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def13]
crun-1.17-build/crun-1.17/src/libcrun/cgroup-internal.h:22: included_from: Included from here.
crun-1.17-build/crun-1.17/src/libcrun/cgroup-systemd.c:23: included_from: Included from here.
crun-1.17-build/crun-1.17/src/libcrun/utils.h: scope_hint: In function 'append_systemd_annotation'
crun-1.17-build/crun-1.17/src/libcrun/utils.h:62:21: warning[-Wanalyzer-malloc-leak]: leak of 'xmalloc(name_len + 2)'
crun-1.17-build/crun-1.17/src/libcrun/utils.h:56:40: note: in definition of macro 'UNLIKELY'
crun-1.17-build/crun-1.17/src/libcrun/utils.h:56:40: note: in definition of macro 'UNLIKELY'
#   60|   {
#   61|     void *res = malloc (size);
#   62|->   if (UNLIKELY (res == NULL))
#   63|       OOM ();
#   64|     return res;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def14]
crun-1.17-build/crun-1.17/src/libcrun/cgroup-internal.h:22: included_from: Included from here.
crun-1.17-build/crun-1.17/src/libcrun/cgroup-systemd.c:23: included_from: Included from here.
crun-1.17-build/crun-1.17/src/libcrun/utils.h: scope_hint: In function ‘append_systemd_annotation’
crun-1.17-build/crun-1.17/src/libcrun/utils.h:62:21: warning[-Wanalyzer-malloc-leak]: leak of ‘xmalloc(256)’
crun-1.17-build/crun-1.17/src/libcrun/utils.h:56:40: note: in definition of macro ‘UNLIKELY’
crun-1.17-build/crun-1.17/src/libcrun/utils.h:56:40: note: in definition of macro ‘UNLIKELY’
#   60|   {
#   61|     void *res = malloc (size);
#   62|->   if (UNLIKELY (res == NULL))
#   63|       OOM ();
#   64|     return res;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def15]
crun-1.17-build/crun-1.17/src/libcrun/utils.h:62:21: warning[-Wanalyzer-malloc-leak]: leak of ‘xmalloc(name_len + 2)’
crun-1.17-build/crun-1.17/src/libcrun/utils.h:56:40: note: in definition of macro ‘UNLIKELY’
crun-1.17-build/crun-1.17/src/libcrun/utils.h:56:40: note: in definition of macro ‘UNLIKELY’
#   60|   {
#   61|     void *res = malloc (size);
#   62|->   if (UNLIKELY (res == NULL))
#   63|       OOM ();
#   64|     return res;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def16]
crun-1.17-build/crun-1.17/src/libcrun/utils.h:222:6: warning[-Wanalyzer-malloc-leak]: leak of 'xstrdup(value + 1)'
#  220|   
#  221|     ret = strdup (str);
#  222|->   if (ret == NULL)
#  223|       OOM ();
#  224|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def17]
crun-1.17-build/crun-1.17/src/libcrun/utils.h: scope_hint: In function 'append_systemd_annotation'
crun-1.17-build/crun-1.17/src/libcrun/utils.h:222:6: warning[-Wanalyzer-malloc-leak]: leak of 'xstrdup(value)'
#  220|   
#  221|     ret = strdup (str);
#  222|->   if (ret == NULL)
#  223|       OOM ();
#  224|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def18]
crun-1.17-build/crun-1.17/src/libcrun/utils.h:222:6: warning[-Wanalyzer-malloc-leak]: leak of ‘xstrdup(value + 1)’
#  220|   
#  221|     ret = strdup (str);
#  222|->   if (ret == NULL)
#  223|       OOM ();
#  224|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def19]
crun-1.17-build/crun-1.17/src/libcrun/utils.h: scope_hint: In function ‘append_systemd_annotation’
crun-1.17-build/crun-1.17/src/libcrun/utils.h:222:6: warning[-Wanalyzer-malloc-leak]: leak of ‘xstrdup(value)’
#  220|   
#  221|     ret = strdup (str);
#  222|->   if (ret == NULL)
#  223|       OOM ();
#  224|   

Scan Properties

analyzer-version-clippy1.82.0
analyzer-version-cppcheck2.16.0
analyzer-version-gcc14.2.1
analyzer-version-gcc-analyzer15.0.0
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.82.0
diffbase-analyzer-version-cppcheck2.16.0
diffbase-analyzer-version-gcc14.2.1
diffbase-analyzer-version-gcc-analyzer15.0.0
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-56.us-west-2.compute.internal
diffbase-mock-configfedora-rawhide-gcc-latest-x86_64
diffbase-project-namecrun-1.18.2-1.fc42
diffbase-store-results-to/tmp/tmpvg03j16k/crun-1.18.2-1.fc42.tar.xz
diffbase-time-created2024-11-12 23:27:17
diffbase-time-finished2024-11-12 23:33:39
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmpvg03j16k/crun-1.18.2-1.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpvg03j16k/crun-1.18.2-1.fc42.src.rpm'
diffbase-tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-56.us-west-2.compute.internal
mock-configfedora-rawhide-gcc-latest-x86_64
project-namecrun-1.17-1.fc41
store-results-to/tmp/tmp6dxn6ovq/crun-1.17-1.fc41.tar.xz
time-created2024-11-12 23:20:27
time-finished2024-11-12 23:27:01
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmp6dxn6ovq/crun-1.17-1.fc41.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmp6dxn6ovq/crun-1.17-1.fc41.src.rpm'
tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9