Fixed defects

List of Defects

Error: SHELLCHECK_WARNING (CWE-398): [#def1]
/usr/bin/dracut:961:23: warning[SC2184]: Quote arguments to unset so they're not glob expanded.
#  959|           case ${dracut_args[$i]} in
#  960|               --regenerate-all | --parallel)
#  961|->                 unset dracut_args["$i"]
#  962|                   ;;
#  963|           esac

Error: SHELLCHECK_WARNING (CWE-457): [#def2]
/usr/lib/dracut/modules.d/95resume/module-setup.sh:44:67: warning[SC2154]: systemdutildir is referenced but not assigned.
#   42|   
#   43|       # if systemd is included and has the hibernate-resume tool, use it and nothing else
#   44|->     if dracut_module_included "systemd" && [[ -x $dracutsysrootdir$systemdutildir/systemd-hibernate-resume ]]; then
#   45|           inst_multiple -o \
#   46|               "$systemdutildir"/system-generators/systemd-hibernate-resume-generator \

Error: SHELLCHECK_WARNING (CWE-457): [#def3]
/usr/lib/dracut/modules.d/95udev-rules/module-setup.sh:14:22: warning[SC2154]: systemdutildir is referenced but not assigned.
#   12|       inst_multiple -o /etc/udev/udev.conf
#   13|   
#   14|->     [[ -d ${initdir}/$systemdutildir ]] || mkdir -p "${initdir}/$systemdutildir"
#   15|       for _i in "${systemdutildir}"/systemd-udevd "${udevdir}"/udevd /sbin/udevd; do
#   16|           [[ -x $dracutsysrootdir$_i ]] || continue

Error: SHELLCHECK_WARNING (CWE-457): [#def4]
/usr/lib/dracut/modules.d/98dracut-systemd/module-setup.sh:23:46: warning[SC2154]: systemdsystemunitdir is referenced but not assigned.
#   21|   install() {
#   22|       inst_script "$moddir/dracut-emergency.sh" /bin/dracut-emergency
#   23|->     inst_simple "$moddir/emergency.service" "${systemdsystemunitdir}"/emergency.service
#   24|       inst_simple "$moddir/dracut-emergency.service" "${systemdsystemunitdir}"/dracut-emergency.service
#   25|       inst_simple "$moddir/emergency.service" "${systemdsystemunitdir}"/rescue.service

Error: SHELLCHECK_WARNING (CWE-457): [#def5]
/usr/lib/dracut/modules.d/98dracut-systemd/module-setup.sh:38:48: warning[SC2154]: systemdutildir is referenced but not assigned.
#   36|       inst_script "$moddir/dracut-pre-pivot.sh" /bin/dracut-pre-pivot
#   37|   
#   38|->     inst_script "$moddir/rootfs-generator.sh" "$systemdutildir"/system-generators/dracut-rootfs-generator
#   39|   
#   40|       for i in \

Error: SHELLCHECK_WARNING (CWE-457): [#def6]
/usr/lib/dracut/modules.d/98dracut-systemd/rootfs-generator.sh:13:16: warning[SC2154]: hookdir is referenced but not assigned.
#   11|       _timeout=${_timeout:-0}
#   12|   
#   13|->     if ! [ -e "$hookdir/initqueue/finished/devexists-${_name}.sh" ]; then
#   14|   
#   15|           # If a LUKS device needs unlocking via systemd in the initrd, assume

Error: SHELLCHECK_WARNING (CWE-569): [#def7]
/usr/lib/dracut/modules.d/98syslog/rsyslogd-start.sh:18:19: warning[SC2048]: Use "$@" (with quotes) to prevent whitespace problems.
#   16|       local syslog_template=$1
#   17|       shift
#   18|->     local filters=$*
#   19|       local filter=
#   20|   

Error: SHELLCHECK_WARNING (CWE-457): [#def8]
/usr/lib/dracut/modules.d/99fs-lib/module-setup.sh:84:50: warning[SC2154]: dracutsysrootdir is referenced but not assigned.
#   82|       _helpers+=(umount mount)
#   83|   
#   84|->     if [[ ${_helpers[*]} == *e2fsck* ]] && [[ -e $dracutsysrootdir/etc/e2fsck.conf ]]; then
#   85|           inst_simple /etc/e2fsck.conf
#   86|       fi

Error: SHELLCHECK_WARNING (CWE-457): [#def9]
/usr/lib/dracut/modules.d/99memstrack/module-setup.sh:25:39: warning[SC2154]: systemdsystemunitdir is referenced but not assigned.
#   23|       inst_hook cleanup 99 "$moddir/memstrack-report.sh"
#   24|   
#   25|->     inst "$moddir/memstrack.service" "$systemdsystemunitdir/memstrack.service"
#   26|   
#   27|       $SYSTEMCTL -q --root "$initdir" add-wants initrd.target memstrack.service

Error: SHELLCHECK_WARNING (CWE-457): [#def10]
/usr/lib/dracut/modules.d/99squash/module-setup.sh:21:15: warning[SC2154]: initdir is referenced but not assigned.
#   19|       # Move everything under $initdir except $squash_dir
#   20|       # itself into squash image
#   21|->     for i in "$initdir"/*; do
#   22|           [[ $squash_dir == "$i"/* ]] || mv "$i" "$squash_dir"/
#   23|       done

Error: SHELLCHECK_WARNING (CWE-156): [#def11]
/usr/lib/kernel/install.d/50-dracut.install:70:13: warning[SC2046]: Quote this to prevent word splitting.
#   68|           dracut -f \
#   69|               ${noimageifnotneeded:+--noimageifnotneeded} \
#   70|->             $([[ "$KERNEL_INSTALL_VERBOSE" == 1 ]] && echo --verbose) \
#   71|               "$BOOT_DIR_ABS/$INITRD" \
#   72|               "$KERNEL_VERSION"

Error: CLANG_WARNING: [#def12]
dracut-059/src/install/dracut-install.c:638:25: warning[unix.Malloc]: Potential leak of memory pointed to by 'dstpath'
#  636|   
#  637|           if (!(srcpath && dstpath))
#  638|->                 return -ENOMEM;
#  639|   
#  640|           size_t dlen = dir_len(src);

Error: CLANG_WARNING: [#def13]
dracut-059/src/install/dracut-install.c:638:25: warning[unix.Malloc]: Potential leak of memory pointed to by 'srcpath'
#  636|   
#  637|           if (!(srcpath && dstpath))
#  638|->                 return -ENOMEM;
#  639|   
#  640|           size_t dlen = dir_len(src);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def14]
dracut-059/src/install/dracut-install.c: scope_hint: In function ‘parse_argv’
dracut-059/src/install/dracut-install.c:1089:41: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘sysrootdir’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null
# 1087|                   case 'r':
# 1088|                           sysrootdir = strdup(optarg);
# 1089|->                         sysrootdirlen = strlen(sysrootdir);
# 1090|                           break;
# 1091|                   case 'p':

Error: CLANG_WARNING: [#def15]
dracut-059/src/install/dracut-install.c:1340:37: warning[unix.Malloc]: Potential leak of memory pointed to by 'dest'
# 1338|                           if (strchr(argv[i], '*') == NULL) {
# 1339|                                   _cleanup_free_ char *dest = strdup(argv[i]);
# 1340|->                                 ret = dracut_install(argv[i], dest, arg_createdir, arg_resolvedeps, true);
# 1341|                           } else {
# 1342|                                   _cleanup_free_ char *realsrc = NULL;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def16]
dracut-059/src/install/dracut-install.c: scope_hint: In function ‘main’
dracut-059/src/install/dracut-install.c:2033:13: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘destrootdir’ where non-null expected
dracut-059/src/install/dracut-install.c:47: included_from: Included from here.
dracut-059/src/install/dracut-install.c:1996:9: note: in expansion of macro ‘log_debug’
dracut-059/src/install/dracut-install.c:36: included_from: Included from here.
/usr/include/string.h:156:12: note: argument 1 of ‘strcmp’ must be non-null
# 2031|           }
# 2032|   
# 2033|->         if (strcmp(destrootdir, "/") == 0) {
# 2034|                   log_error("Environment DESTROOTDIR or argument -D is set to '/'!");
# 2035|                   usage(EXIT_FAILURE);

Error: COMPILER_WARNING (CWE-457): [#def17]
dracut-059/src/install/util.h:535:9: warning[-Wmaybe-uninitialized]: ‘dst’ may be used uninitialized
#  535 |         free(*(void **)p);
#      |         ^~~~~~~~~~~~~~~~~
dracut-059/src/install/dracut-install.c: scope_hint: In function ‘dracut_install’
dracut-059/src/install/dracut-install.c:756:30: note: ‘dst’ was declared here
#  756 |         _cleanup_free_ char *dst;
#      |                              ^~~
#  533|   static inline void freep(void *p)
#  534|   {
#  535|->         free(*(void **)p);
#  536|   }
#  537|   

Scan Properties

analyzer-version-clang18.1.3
analyzer-version-cppcheck2.13.0
analyzer-version-gcc14.0.1
analyzer-version-gcc-analyzer14.0.1
analyzer-version-shellcheck0.10.0
diffbase-analyzer-version-clang18.1.3
diffbase-analyzer-version-cppcheck2.13.0
diffbase-analyzer-version-gcc14.0.1
diffbase-analyzer-version-gcc-analyzer14.0.1
diffbase-analyzer-version-shellcheck0.10.0
diffbase-enabled-pluginsclang, cppcheck, gcc, shellcheck
diffbase-exit-code0
diffbase-hostip-172-16-1-252.us-west-2.compute.internal
diffbase-mock-configfedora-41-x86_64
diffbase-project-namedracut-060-1.fc41
diffbase-store-results-to/tmp/tmp1xbjx52o/dracut-060-1.fc41.tar.xz
diffbase-time-created2024-04-22 10:48:00
diffbase-time-finished2024-04-22 10:49:44
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmp1xbjx52o/dracut-060-1.fc41.tar.xz' '--gcc-analyze' '/tmp/tmp1xbjx52o/dracut-060-1.fc41.src.rpm'
diffbase-tool-versioncsmock-3.5.3-1.el9
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-252.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-namedracut-059-22.fc40
store-results-to/tmp/tmpp05uu476/dracut-059-22.fc40.tar.xz
time-created2024-04-22 10:45:16
time-finished2024-04-22 10:47:33
titleFixed defects
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpp05uu476/dracut-059-22.fc40.tar.xz' '--gcc-analyze' '/tmp/tmpp05uu476/dracut-059-22.fc40.src.rpm'
tool-versioncsmock-3.5.3-1.el9