Fixed findings

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1]
libvirt-10.6.0-build/libvirt-10.6.0/src/qemu/qemu_snapshot.c: scope_hint: In function ‘qemuSnapshotRevertExternalActive’
libvirt-10.6.0-build/libvirt-10.6.0/src/qemu/qemu_snapshot.c:2150:16: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘tmpsnapdef’
libvirt-10.6.0-build/libvirt-10.6.0/src/util/virmacaddr.h:23: included_from: Included from here.
libvirt-10.6.0-build/libvirt-10.6.0/src/util/virebtables.h:24: included_from: Included from here.
libvirt-10.6.0-build/libvirt-10.6.0/src/qemu/qemu_conf.h:26: included_from: Included from here.
libvirt-10.6.0-build/libvirt-10.6.0/src/qemu/qemu_snapshot.h:22: included_from: Included from here.
libvirt-10.6.0-build/libvirt-10.6.0/src/qemu/qemu_snapshot.c:23: included_from: Included from here.
libvirt-10.6.0-build/libvirt-10.6.0/src/qemu/qemu_snapshot.c:2556:5: note: in expansion of macro ‘virCheckFlags’
libvirt-10.6.0-build/libvirt-10.6.0/src/qemu/qemu_snapshot.c: scope_hint: In function ‘qemuSnapshotRevertExternalActive’
libvirt-10.6.0-build/libvirt-10.6.0/src/internal.h:81:33: note: in definition of macro ‘STRNEQ’
/usr/lib64/glib-2.0/include/glibconfig.h:9: included_from: Included from here.
/usr/include/glib-2.0/glib/gtypes.h:34: included_from: Included from here.
/usr/include/glib-2.0/glib/galloca.h:34: included_from: Included from here.
/usr/include/glib-2.0/glib.h:32: included_from: Included from here.
libvirt-10.6.0-build/libvirt-10.6.0/src/util/glibcompat.h:21: included_from: Included from here.
libvirt-10.6.0-build/libvirt-10.6.0/src/internal.h:30: included_from: Included from here.
/usr/include/glib-2.0/glib/gmacros.h:1365:7: note: in expansion of macro ‘_GLIB_AUTOPTR_CLEAR_FUNC_NAME’
/usr/include/glib-2.0/glib/gmacros.h:1381:3: note: in expansion of macro ‘_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS’
libvirt-10.6.0-build/libvirt-10.6.0/src/conf/domain_conf.h:3679:1: note: in expansion of macro ‘G_DEFINE_AUTOPTR_CLEANUP_FUNC’
/usr/include/glib-2.0/glib/gmacros.h:1381:3: note: in expansion of macro ‘_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS’
libvirt-10.6.0-build/libvirt-10.6.0/src/conf/domain_conf.h:3679:1: note: in expansion of macro ‘G_DEFINE_AUTOPTR_CLEANUP_FUNC’
# 2148|       g_autoptr(qemuSnapshotDiskContext) snapctxt = NULL;
# 2149|   
# 2150|->     snapctxt = qemuSnapshotDiskContextNew(tmpsnapdef->ndisks, vm, VIR_ASYNC_JOB_SNAPSHOT);
# 2151|   
# 2152|       if (!(blockNamedNodeData = qemuBlockGetNamedNodeData(vm, VIR_ASYNC_JOB_SNAPSHOT)))

Error: COMPILER_WARNING (CWE-477): [#def2]
libvirt-10.6.0-build/libvirt-10.6.0/src/rpc/virnetlibsshsession.c: scope_hint: In function ‘virNetLibsshChannelRead’
libvirt-10.6.0-build/libvirt-10.6.0/src/rpc/virnetlibsshsession.c:1183:9: warning[-Wdeprecated-declarations]: ‘ssh_channel_get_exit_status’ is deprecated
# 1183 |         if (ssh_channel_get_exit_status(sess->channel)) {
#      |         ^~
libvirt-10.6.0-build/libvirt-10.6.0/src/rpc/virnetlibsshsession.c:21: included_from: Included from here.
/usr/include/libssh/libssh.h:471:31: note: declared here
#  471 | SSH_DEPRECATED LIBSSH_API int ssh_channel_get_exit_status(ssh_channel channel);
#      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1181|       if (ssh_channel_is_eof(sess->channel)) {
# 1182|    eof:
# 1183|->         if (ssh_channel_get_exit_status(sess->channel)) {
# 1184|               virReportError(VIR_ERR_LIBSSH,
# 1185|                              _("Remote command terminated with non-zero code: %1$d"),

Error: COMPILER_WARNING (CWE-477): [#def3]
libvirt-10.6.0-build/libvirt-10.6.0/src/rpc/virnetlibsshsession.c:1184:13: warning[-Wdeprecated-declarations]: ‘ssh_channel_get_exit_status’ is deprecated
# 1184 |             virReportError(VIR_ERR_LIBSSH,
#      |             ^~~~~~~~~~~~~~
/usr/include/libssh/libssh.h:471:31: note: declared here
#  471 | SSH_DEPRECATED LIBSSH_API int ssh_channel_get_exit_status(ssh_channel channel);
#      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1182|    eof:
# 1183|           if (ssh_channel_get_exit_status(sess->channel)) {
# 1184|->             virReportError(VIR_ERR_LIBSSH,
# 1185|                              _("Remote command terminated with non-zero code: %1$d"),
# 1186|                              ssh_channel_get_exit_status(sess->channel));

Error: COMPILER_WARNING (CWE-477): [#def4]
libvirt-10.6.0-build/libvirt-10.6.0/src/rpc/virnetlibsshsession.c:1187:13: warning[-Wdeprecated-declarations]: ‘ssh_channel_get_exit_status’ is deprecated
# 1187 |             sess->channelCommandReturnValue = ssh_channel_get_exit_status(sess->channel);
#      |             ^~~~
/usr/include/libssh/libssh.h:471:31: note: declared here
#  471 | SSH_DEPRECATED LIBSSH_API int ssh_channel_get_exit_status(ssh_channel channel);
#      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1185|                              _("Remote command terminated with non-zero code: %1$d"),
# 1186|                              ssh_channel_get_exit_status(sess->channel));
# 1187|->             sess->channelCommandReturnValue = ssh_channel_get_exit_status(sess->channel);
# 1188|               sess->state = VIR_NET_LIBSSH_STATE_ERROR_REMOTE;
# 1189|               virObjectUnlock(sess);

Error: COMPILER_WARNING (CWE-477): [#def5]
libvirt-10.6.0-build/libvirt-10.6.0/src/rpc/virnetlibsshsession.c: scope_hint: In function ‘virNetLibsshChannelWrite’
libvirt-10.6.0-build/libvirt-10.6.0/src/rpc/virnetlibsshsession.c:1230:9: warning[-Wdeprecated-declarations]: ‘ssh_channel_get_exit_status’ is deprecated
# 1230 |         if (ssh_channel_get_exit_status(sess->channel)) {
#      |         ^~
/usr/include/libssh/libssh.h:471:31: note: declared here
#  471 | SSH_DEPRECATED LIBSSH_API int ssh_channel_get_exit_status(ssh_channel channel);
#      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1228|   
# 1229|       if (ssh_channel_is_eof(sess->channel)) {
# 1230|->         if (ssh_channel_get_exit_status(sess->channel)) {
# 1231|               virReportError(VIR_ERR_LIBSSH,
# 1232|                              _("Remote program terminated with non-zero code: %1$d"),

Error: COMPILER_WARNING (CWE-477): [#def6]
libvirt-10.6.0-build/libvirt-10.6.0/src/rpc/virnetlibsshsession.c:1231:13: warning[-Wdeprecated-declarations]: ‘ssh_channel_get_exit_status’ is deprecated
# 1231 |             virReportError(VIR_ERR_LIBSSH,
#      |             ^~~~~~~~~~~~~~
/usr/include/libssh/libssh.h:471:31: note: declared here
#  471 | SSH_DEPRECATED LIBSSH_API int ssh_channel_get_exit_status(ssh_channel channel);
#      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1229|       if (ssh_channel_is_eof(sess->channel)) {
# 1230|           if (ssh_channel_get_exit_status(sess->channel)) {
# 1231|->             virReportError(VIR_ERR_LIBSSH,
# 1232|                              _("Remote program terminated with non-zero code: %1$d"),
# 1233|                              ssh_channel_get_exit_status(sess->channel));

Error: COMPILER_WARNING (CWE-477): [#def7]
libvirt-10.6.0-build/libvirt-10.6.0/src/rpc/virnetlibsshsession.c:1235:13: warning[-Wdeprecated-declarations]: ‘ssh_channel_get_exit_status’ is deprecated
# 1235 |             sess->channelCommandReturnValue = ssh_channel_get_exit_status(sess->channel);
#      |             ^~~~
/usr/include/libssh/libssh.h:471:31: note: declared here
#  471 | SSH_DEPRECATED LIBSSH_API int ssh_channel_get_exit_status(ssh_channel channel);
#      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1233|                              ssh_channel_get_exit_status(sess->channel));
# 1234|               sess->state = VIR_NET_LIBSSH_STATE_ERROR_REMOTE;
# 1235|->             sess->channelCommandReturnValue = ssh_channel_get_exit_status(sess->channel);
# 1236|   
# 1237|               ret = -1;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def8]
libvirt-10.6.0-build/libvirt-10.6.0/tests/commandhelper.c:73:5: warning[-Wanalyzer-null-argument]: use of NULL ‘fopen("/builddir/build/BUILD/libvirt-10.6.0-build/libvirt-10.6.0/redhat-linux-build/tests/commandhelper.log", "w")’ where non-null expected
libvirt-10.6.0-build/libvirt-10.6.0/tests/commandhelper.c: scope_hint: In function ‘main’
/usr/include/stdio.h: scope_hint: In function ‘main’
/usr/include/stdio.h:184:12: note: argument 1 of ‘fclose’ must be non-null
#   71|   {
#   72|       FILE *file = *ptr;
#   73|->     fclose(file);
#   74|   }
#   75|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def9]
libvirt-10.6.0-build/libvirt-10.6.0/tests/commandhelper.c: scope_hint: In function ‘main’
libvirt-10.6.0-build/libvirt-10.6.0/tests/commandhelper.c:350:17: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen("/builddir/build/BUILD/libvirt-10.6.0-build/libvirt-10.6.0/redhat-linux-build/tests/commandhelper.log", "w")’
#  348|       cleanup(FILE *, cleanupFile) log = NULL;
#  349|   
#  350|->     if (!(log = fopen(abs_builddir "/commandhelper.log", "w")))
#  351|           return EXIT_FAILURE;
#  352|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def10]
libvirt-10.6.0-build/libvirt-10.6.0/tests/commandhelper.c:350:17: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen("/builddir/build/BUILD/libvirt-10.6.0-build/libvirt-10.6.0/redhat-linux-build/tests/commandhelper.log", "w")’
#  348|       cleanup(FILE *, cleanupFile) log = NULL;
#  349|   
#  350|->     if (!(log = fopen(abs_builddir "/commandhelper.log", "w")))
#  351|           return EXIT_FAILURE;
#  352|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def11]
libvirt-10.6.0-build/libvirt-10.6.0/tests/securityselinuxlabeltest.c: scope_hint: In function ‘testSELinuxLoadFileList’
libvirt-10.6.0-build/libvirt-10.6.0/tests/securityselinuxlabeltest.c:107:16: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(g_strdup_printf("%s/securityselinuxlabeldata/%s.txt", "/builddir/build/BUILD/libvirt-10.6.0-build/libvirt-10.6.0/tests", testname), "r")’
#  105|                              testname);
#  106|   
#  107|->     if (!(fp = fopen(path, "r")))
#  108|           return -1;
#  109|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def12]
libvirt-10.6.0-build/libvirt-10.6.0/tests/securityselinuxlabeltest.c:107:16: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(g_strdup_printf("%s/securityselinuxlabeldata/%s.txt", "/builddir/build/BUILD/libvirt-10.6.0-build/libvirt-10.6.0/tests", testname), "r")’
#  105|                              testname);
#  106|   
#  107|->     if (!(fp = fopen(path, "r")))
#  108|           return -1;
#  109|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def13]
libvirt-10.6.0-build/libvirt-10.6.0/tests/virhostcputest.c: scope_hint: In function ‘hostCPUSignature’
libvirt-10.6.0-build/libvirt-10.6.0/tests/virhostcputest.c:193:15: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(g_strdup_printf("%s/virhostcpudata/linux-%s-%s.cpuinfo", "/builddir/build/BUILD/libvirt-10.6.0-build/libvirt-10.6.0/tests", virArchToString(*(const struct linuxTestHostCPUData *)opaque.arch), *(const struct linuxTestHostCPUData *)opaque.testName), "r")’
#  191|                                  abs_srcdir, arch, data->testName);
#  192|   
#  193|->     if (!(f = fopen(cpuinfo, "r"))) {
#  194|           virReportSystemError(errno,
#  195|                                "Failed to open cpuinfo file '%s'", cpuinfo);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def14]
libvirt-10.6.0-build/libvirt-10.6.0/tests/virhostcputest.c:193:15: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(g_strdup_printf("%s/virhostcpudata/linux-%s-%s.cpuinfo", "/builddir/build/BUILD/libvirt-10.6.0-build/libvirt-10.6.0/tests", virArchToString(*(const struct linuxTestHostCPUData *)opaque.arch), *(const struct linuxTestHostCPUData *)opaque.testName), "r")’
#  191|                                  abs_srcdir, arch, data->testName);
#  192|   
#  193|->     if (!(f = fopen(cpuinfo, "r"))) {
#  194|           virReportSystemError(errno,
#  195|                                "Failed to open cpuinfo file '%s'", cpuinfo);

Error: COMPILER_WARNING (CWE-477): [#def15]
libvirt-10.6.0-build/libvirt-10.6.0/tests/viridentitytest.c: scope_hint: In function ‘testDisableFakeSELinux’
libvirt-10.6.0-build/libvirt-10.6.0/tests/viridentitytest.c:137:5: warning[-Wdeprecated-declarations]: ‘security_disable’ is deprecated
#  137 |     return security_disable();
#      |     ^~~~~~
libvirt-10.6.0-build/libvirt-10.6.0/tests/viridentitytest.c:23: included_from: Included from here.
/usr/include/selinux/selinux.h:375:12: note: declared here
#  375 | extern int security_disable(void);
#      |            ^~~~~~~~~~~~~~~~
#  135|   {
#  136|   #if WITH_SELINUX
#  137|->     return security_disable();
#  138|   #else
#  139|       VIR_DEBUG("libvirt not compiled with SELinux, skipping this test");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def16]
libvirt-10.6.0-build/libvirt-10.6.0/tools/nss/libvirt_nss_macs.c: scope_hint: In function ‘findMACsParserString’
libvirt-10.6.0-build/libvirt-10.6.0/tools/nss/libvirt_nss_macs.c:86:12: warning[-Wanalyzer-malloc-leak]: leak of ‘strndup(stringVal,  stringLen)’
#   84|   
#   85|           parser->entry.macs = macs;
#   86|->         if (!(macs[parser->entry.nmacs++] = strndup((char *)stringVal, stringLen)))
#   87|               return 0;
#   88|       } else {

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-69.us-west-2.compute.internal
diffbase-mock-configfedora-rawhide-gcc-latest-x86_64
diffbase-project-namelibvirt-10.9.0-1.fc42
diffbase-store-results-to/tmp/tmp4_d0ste2/libvirt-10.9.0-1.fc42.tar.xz
diffbase-time-created2024-11-13 01:57:44
diffbase-time-finished2024-11-13 02:09:54
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmp4_d0ste2/libvirt-10.9.0-1.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmp4_d0ste2/libvirt-10.9.0-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-69.us-west-2.compute.internal
mock-configfedora-rawhide-gcc-latest-x86_64
project-namelibvirt-10.6.0-5.fc41
store-results-to/tmp/tmp7k57ns1y/libvirt-10.6.0-5.fc41.tar.xz
time-created2024-11-13 01:44:43
time-finished2024-11-13 01:57:28
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmp7k57ns1y/libvirt-10.6.0-5.fc41.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmp7k57ns1y/libvirt-10.6.0-5.fc41.src.rpm'
tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9