dracut-102-1.fc41

List of Defects

Error: COMPILER_WARNING (CWE-457): [#def1]
dracut-102-build/dracut-ng-102/src/install/dracut-install.c:148:12: warning[-Wmaybe-uninitialized]: ‘fts’ may be used uninitialized
#  148 |         if (*p)
#      |            ^
dracut-102-build/dracut-ng-102/src/install/dracut-install.c: scope_hint: In function ‘install_modules’
dracut-102-build/dracut-ng-102/src/install/dracut-install.c:1582:34: note: ‘fts’ was declared here
# 1582 |         _cleanup_fts_close_ FTS *fts;
#      |                                  ^~~
#  146|   static inline void fts_closep(FTS **p)
#  147|   {
#  148|->         if (*p)
#  149|                   fts_close(*p);
#  150|   }

Error: CLANG_WARNING: [#def2]
dracut-102-build/dracut-ng-102/src/install/dracut-install.c:202:18: warning[unix.Malloc]: Potential leak of memory pointed to by 'from_dir_p'
#  200|           /* dir_len() skips double /'s e.g. //lib64, so we can't skip just one
#  201|            * character - need to skip all leading /'s */
#  202|->         for (i = dirlen + 1; from[i] == '/'; ++i)
#  203|                   ;
#  204|           _asprintf(&realfrom, "%s/%s", buf, from + i);

Error: CLANG_WARNING: [#def3]
dracut-102-build/dracut-ng-102/src/install/dracut-install.c:215:18: warning[unix.Malloc]: Potential leak of memory pointed to by 'target_dir_p'
#  213|           }
#  214|   
#  215|->         for (i = dirlen + 1; target[i] == '/'; ++i)
#  216|                   ;
#  217|           _asprintf(&realtarget, "%s/%s", buf, target + i);

Error: CLANG_WARNING: [#def4]
dracut-102-build/dracut-ng-102/src/install/dracut-install.c:343:17: warning[deadcode.DeadStores]: Value stored to 'dest_desc' is never read
#  341|                   }
#  342|                   close(dest_desc);
#  343|->                 dest_desc = -1;
#  344|                   /* clone did not work, remove the file */
#  345|                   unlink(dst);

Error: CLANG_WARNING: [#def5]
dracut-102-build/dracut-ng-102/src/install/dracut-install.c:411:24: warning[unix.Malloc]: Potential leak of memory pointed to by 'p'
#  409|           pdir = dirname_malloc(p);
#  410|           if (!pdir)
#  411|->                 return ret;
#  412|   
#  413|           ppdir = dirname_malloc(pdir);

Error: CLANG_WARNING: [#def6]
dracut-102-build/dracut-ng-102/src/install/dracut-install.c:531:33: warning[unix.Malloc]: Potential leak of memory pointed to by 'buf'
#  529|                   fd = open(fullsrcpath, O_RDONLY | O_CLOEXEC);
#  530|                   if (fd < 0)
#  531|->                         return -errno;
#  532|   
#  533|                   ret = read(fd, buf, linesize - 1);

Error: CLANG_WARNING: [#def7]
dracut-102-build/dracut-ng-102/src/install/dracut-install.c:757:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'parent'
#  755|           }
#  756|   
#  757|->         return 0;
#  758|   }
#  759|   

Error: CLANG_WARNING: [#def8]
dracut-102-build/dracut-ng-102/src/install/dracut-install.c:757:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'path'
#  755|           }
#  756|   
#  757|->         return 0;
#  758|   }
#  759|   

Error: CLANG_WARNING: [#def9]
dracut-102-build/dracut-ng-102/src/install/dracut-install.c:795:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'fullsrcpath'
#  793|   
#  794|           if (check_hashmap(items_failed, src)) {
#  795|->                 log_debug("hash hit items_failed for '%s'", src);
#  796|                   return 1;
#  797|           }

Error: CLANG_WARNING: [#def10]
dracut-102-build/dracut-ng-102/src/install/dracut-install.c:860:29: warning[unix.Malloc]: Potential leak of memory pointed to by 'dname'
#  858|                           if (!dname)
#  859|                                   return 1;
#  860|->                         ret = dracut_install(dname, dname, true, false, true);
#  861|   
#  862|                           if (ret != 0) {

Error: CLANG_WARNING: [#def11]
dracut-102-build/dracut-ng-102/src/install/dracut-install.c:868:21: warning[unix.Malloc]: Potential leak of memory pointed to by 'fulldstdir'
#  866|                   }
#  867|   
#  868|->                 if (src_isdir) {
#  869|                           if (dst_exists) {
#  870|                                   if (S_ISDIR(sb.st_mode)) {

Error: CLANG_WARNING: [#def12]
dracut-102-build/dracut-ng-102/src/install/dracut-install.c:1421:17: warning[deadcode.DeadStores]: Value stored to 'ret' is never read
# 1419|                   value = kmod_module_info_get_value(l);
# 1420|                   log_debug("Firmware %s", value);
# 1421|->                 ret = -1;
# 1422|                   STRV_FOREACH(q, firmwaredirs) {
# 1423|                           _cleanup_free_ char *fwpath = NULL;

Error: COMPILER_WARNING: [#def13]
dracut-102-build/dracut-ng-102/src/install/dracut-install.c: scope_hint: In function ‘find_suppliers_for_sys_node’
dracut-102-build/dracut-ng-102/src/install/dracut-install.c:1576:17: warning[-Wstringop-overflow=]: ‘strncat’ specified bound 3 equals source length
# 1574|                           closedir(d);
# 1575|                   }
# 1576|->                 strncat(node_path, "/..", 3); // Also find suppliers of parents
# 1577|           }
# 1578|   }

Error: GCC_ANALYZER_WARNING (CWE-775): [#def14]
dracut-102-build/dracut-ng-102/src/install/dracut-install.c: scope_hint: In function ‘modalias_list’
dracut-102-build/dracut-ng-102/src/install/dracut-install.c:1797:27: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(*ftsent.fts_accpath, "r")’
# 1795|                   if (strncmp("modalias", ftsent->fts_name, 8) != 0)
# 1796|                           continue;
# 1797|->                 if (!(f = fopen(ftsent->fts_accpath, "r")))
# 1798|                           continue;
# 1799|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def15]
dracut-102-build/dracut-ng-102/src/install/dracut-install.c:1797:27: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(*ftsent.fts_accpath, "r")’
# 1795|                   if (strncmp("modalias", ftsent->fts_name, 8) != 0)
# 1796|                           continue;
# 1797|->                 if (!(f = fopen(ftsent->fts_accpath, "r")))
# 1798|                           continue;
# 1799|   

Error: CLANG_WARNING: [#def16]
dracut-102-build/dracut-ng-102/src/install/dracut-install.c:1951:49: warning[unix.Malloc]: Potential leak of memory pointed to by 'modname'
# 1949|                                           if (!arg_silent)
# 1950|                                                   log_error("3 Failed to lookup alias '%s': %d", modname, r);
# 1951|->                                         return -ENOENT;
# 1952|                                   }
# 1953|                                   log_info("3 Failed to lookup alias '%s': %d", modname, r);

Error: CLANG_WARNING: [#def17]
dracut-102-build/dracut-ng-102/src/install/dracut-install.c:2217:9: warning[deadcode.DeadStores]: Value stored to 'r' is never read
# 2215|           }
# 2216|   
# 2217|->         r = EXIT_SUCCESS;
# 2218|   
# 2219|           if (((optind + 1) < argc) && (strcmp(argv[optind + 1], destrootdir) == 0)) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def18]
dracut-102-build/dracut-ng-102/src/install/strv.c: scope_hint: In function ‘strv_push’
dracut-102-build/dracut-ng-102/src/install/strv.c:416:12: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
dracut-102-build/dracut-ng-102/src/install/strv.c:26: included_from: Included from here.
dracut-102-build/dracut-ng-102/src/install/strv.c:562:9: note: in expansion of macro ‘NULSTR_FOREACH’
dracut-102-build/dracut-ng-102/src/install/strv.c: scope_hint: In function ‘strv_push’
dracut-102-build/dracut-ng-102/src/install/strv.c: scope_hint: In function ‘strv_push’
dracut-102-build/dracut-ng-102/src/install/strv.c: scope_hint: In function ‘strv_push’
dracut-102-build/dracut-ng-102/src/install/strv.c:562:9: note: in expansion of macro ‘NULSTR_FOREACH’
dracut-102-build/dracut-ng-102/src/install/strv.c:562:9: note: in expansion of macro ‘NULSTR_FOREACH’
dracut-102-build/dracut-ng-102/src/install/strv.c: scope_hint: In function ‘strv_push’
dracut-102-build/dracut-ng-102/src/install/strv.c: scope_hint: In function ‘strv_push’
dracut-102-build/dracut-ng-102/src/install/strv.c: scope_hint: In function ‘strv_push’
#  414|           n = strv_length(*l);
#  415|           c = realloc(*l, sizeof(char *) * (n + 2));
#  416|->         if (!c)
#  417|                   return -ENOMEM;
#  418|   

Error: GCC_ANALYZER_WARNING (CWE-1341): [#def19]
dracut-102-build/dracut-ng-102/src/install/util.c: scope_hint: In function ‘close_nointr’
dracut-102-build/dracut-ng-102/src/install/util.c:75:21: warning[-Wanalyzer-fd-double-close]: double ‘close’ of file descriptor ‘fd’
dracut-102-build/dracut-ng-102/src/install/util.h:40: included_from: Included from here.
dracut-102-build/dracut-ng-102/src/install/util.c:30: included_from: Included from here.
dracut-102-build/dracut-ng-102/src/install/macro.h:136:22: note: in expansion of macro ‘assert_se’
dracut-102-build/dracut-ng-102/src/install/util.c:70:9: note: in expansion of macro ‘assert’
dracut-102-build/dracut-ng-102/src/install/util.c:24: included_from: Included from here.
#   73|                   int r;
#   74|   
#   75|->                 r = close(fd);
#   76|                   if (r >= 0)
#   77|                           return r;

Error: CPPCHECK_WARNING: [#def20]
dracut-102-build/dracut-ng-102/src/util/util.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-476): [#def21]
dracut-102-build/dracut-ng-102/src/util/util.c: scope_hint: In function ‘next_arg’
dracut-102-build/dracut-ng-102/src/util/util.c:70:13: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘args’
#   68|           char *next;
#   69|   
#   70|->         if (*args == '"') {
#   71|                   args++;
#   72|                   in_quote = 1;

Error: CLANG_WARNING: [#def22]
dracut-102-build/dracut-ng-102/src/util/util.c:211:29: warning[unix.Malloc]: Potential leak of memory pointed to by 'cmdline'
#  209|                   cmdline = next_arg(cmdline, &key, &value);
#  210|                   if (strcmp(key, search_key) == 0) {
#  211|->                         if (value) {
#  212|                                   end_value = value;
#  213|                                   bool_value = -1;

Error: CLANG_WARNING: [#def23]
dracut-102-build/dracut-ng-102/src/util/util.c:211:29: warning[unix.Malloc]: Potential leak of memory pointed to by 'key'
#  209|                   cmdline = next_arg(cmdline, &key, &value);
#  210|                   if (strcmp(key, search_key) == 0) {
#  211|->                         if (value) {
#  212|                                   end_value = value;
#  213|                                   bool_value = -1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def24]
dracut-102-build/dracut-ng-102/src/util/util.c: scope_hint: In function ‘getarg’
dracut-102-build/dracut-ng-102/src/util/util.c:234:12: warning[-Wanalyzer-malloc-leak]: leak of ‘cmdline’
dracut-102-build/dracut-ng-102/src/util/util.c:54:16: note: in expansion of macro ‘kernel_isspace’
dracut-102-build/dracut-ng-102/src/util/util.c: scope_hint: In function ‘getarg’
#  232|           }
#  233|   
#  234|->         if (bool_value) {
#  235|                   return EXIT_SUCCESS;
#  236|           }

Error: CLANG_WARNING: [#def25]
dracut-102-build/dracut-ng-102/src/util/util.c:289:18: warning[unix.Malloc]: Potential leak of memory pointed to by 'key'
#  287|                           }
#  288|                   }
#  289|->         } while (cmdline[0]);
#  290|           return found_value ? EXIT_SUCCESS : EXIT_FAILURE;
#  291|   }

Error: CLANG_WARNING: [#def26]
dracut-102-build/dracut-ng-102/src/util/util.c:290:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'cmdline'
#  288|                   }
#  289|           } while (cmdline[0]);
#  290|->         return found_value ? EXIT_SUCCESS : EXIT_FAILURE;
#  291|   }
#  292|   

Scan Properties

analyzer-version-clang18.1.7
analyzer-version-cppcheck2.14.2
analyzer-version-gcc14.1.1
analyzer-version-gcc-analyzer14.1.1
analyzer-version-shellcheck0.10.0
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-6.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-namedracut-102-1.fc41
store-results-to/tmp/tmpubiola33/dracut-102-1.fc41.tar.xz
time-created2024-07-03 12:29:00
time-finished2024-07-03 12:30:25
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpubiola33/dracut-102-1.fc41.tar.xz' '--gcc-analyze' '/tmp/tmpubiola33/dracut-102-1.fc41.src.rpm'
tool-versioncsmock-3.5.3-1.el9