psmisc-23.7-1.fc41

List of Defects

Error: CPPCHECK_WARNING: [#def1]
psmisc-23.7-build/psmisc-23.7/src/fuser.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
psmisc-23.7-build/psmisc-23.7/src/fuser.c: scope_hint: In function ‘add_matched_proc’
psmisc-23.7-build/psmisc-23.7/src/fuser.c:442:8: warning[-Wanalyzer-malloc-leak]: leak of ‘pptr’
#  440|       if (pathname)
#  441|           free(pathname);
#  442|->     if (fp)
#  443|           fclose(fp);
#  444|   }

Error: CLANG_WARNING: [#def3]
psmisc-23.7-build/psmisc-23.7/src/fuser.c:2165:18: warning[deadcode.DeadStores]: Although the value stored to 'end' is used in the enclosing expression, the value is never actually read from 'end'
# 2163|       }
# 2164|   
# 2165|->     for (start = end = path; *start; start = end)
# 2166|       {
# 2167|           while (*start == '/')

Error: CLANG_WARNING: [#def4]
psmisc-23.7-build/psmisc-23.7/src/fuser.c:2222:13: warning[deadcode.DeadStores]: Value stored to 'path' is never read
# 2220|   
# 2221|               memmove(&tmpbuf[n], end, len + 1);
# 2222|->             path = end = memcpy(tmpbuf, lnkbuf, n);
# 2223|   
# 2224|               if (lnkbuf[0] == '/')

Error: CPPCHECK_WARNING: [#def5]
psmisc-23.7-build/psmisc-23.7/src/killall.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def6]
psmisc-23.7-build/psmisc-23.7/src/killall.c:305:2: warning[core.CallAndMessage]: Called function pointer is null (null dereference)
#  303|       if (my_getpidcon && selinux_enabled && !my_getpidcon(pid, &lcontext)) {
#  304|           retval = (regexec(scontext, lcontext, 0, NULL, 0) ==0);
#  305|-> 	my_freecon(lcontext);
#  306|       } else {
#  307|           FILE *file;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
psmisc-23.7-build/psmisc-23.7/src/killall.c: scope_hint: In function ‘load_process_name_and_age’
psmisc-23.7-build/psmisc-23.7/src/killall.c:414:16: warning[-Wanalyzer-malloc-leak]: leak of ‘file’
#  412|   
#  413|       if ( (fd = openat(pidfd, "stat", O_RDONLY, 0)) < 0)
#  414|->         return -1;
#  415|       if (!(file = fdopen (fd, "r")))
#  416|       {

Error: GCC_ANALYZER_WARNING (CWE-457): [#def8]
psmisc-23.7-build/psmisc-23.7/src/killall.c: scope_hint: In function ‘load_proc_cmdline’
psmisc-23.7-build/psmisc-23.7/src/killall.c:503:33: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*command_buf’
#  501|               }
#  502|           }
#  503|->         if (strlen(command_buf) == 0) {
#  504|               okay = 0;
#  505|               break;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def9]
psmisc-23.7-build/psmisc-23.7/src/killall.c:530:15: warning[-Wanalyzer-malloc-leak]: leak of ‘file’
#  528|           return -1;
#  529|       }
#  530|->     *got_long = okay;
#  531|       return 0;
#  532|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def10]
psmisc-23.7-build/psmisc-23.7/src/killall.c: scope_hint: In function ‘create_pid_table’
psmisc-23.7-build/psmisc-23.7/src/killall.c:550:8: warning[-Wanalyzer-malloc-leak]: leak of ‘opendir("/proc")’
#  548|       *max_pids = 256;
#  549|       pid_table = malloc (*max_pids * sizeof (pid_t));
#  550|->     if (!pid_table)
#  551|       {
#  552|           perror ("malloc");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def11]
psmisc-23.7-build/psmisc-23.7/src/killall.c: scope_hint: In function ‘kill_all’
psmisc-23.7-build/psmisc-23.7/src/killall.c:558:37: warning[-Wanalyzer-malloc-leak]: leak of ‘create_pid_table(&max_pids, & pids)’
#  556|       while ( (de = readdir (dir)) != NULL)
#  557|       {
#  558|->         if (!(pid = (pid_t) atoi (de->d_name)) || pid == self)
#  559|               continue;
#  560|           if (*pids == *max_pids)

Error: CLANG_WARNING: [#def12]
psmisc-23.7-build/psmisc-23.7/src/killall.c:758:22: warning[core.NullDereference]: Array access (from variable 'pgids') results in a null pointer dereference
#  756|   
#  757|               id = getpgid (pid_table[i]);
#  758|->             pgids[i] = id;
#  759|               if (id < 0)
#  760|               {

Error: CLANG_WARNING: [#def13]
psmisc-23.7-build/psmisc-23.7/src/killall.c:800:32: warning[core.BitwiseShift]: Right operand is negative in left shift
#  798|           /* killall returns a zero return code if at least one process has 
#  799|            * been killed for each listed command. */
#  800|->         error = found == ((1UL << (name_count - 1)) | ((1UL << (name_count - 1)) - 1)) ? 0 : 1;
#  801|       else
#  802|           /* in nameless mode killall returns a zero return code if at least 

Error: CLANG_WARNING: [#def14]
psmisc-23.7-build/psmisc-23.7/src/killall.c:938:9: warning[deadcode.DeadStores]: Value stored to 'name' is never read
#  936|           name++;
#  937|       else
#  938|->         name = *argv;
#  939|       sig_num = SIGTERM;
#  940|   

Error: CPPCHECK_WARNING: [#def15]
psmisc-23.7-build/psmisc-23.7/src/peekfd.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-479): [#def16]
psmisc-23.7-build/psmisc-23.7/src/peekfd.c: scope_hint: In function ‘detach’
psmisc-23.7-build/psmisc-23.7/src/peekfd.c:173:17: warning[-Wanalyzer-unsafe-call-within-signal-handler]: call to ‘free’ from within signal handler
#  171|   		ptrace(PTRACE_DETACH, attached_pids[i], 0, 0);
#  172|   	if (fds)
#  173|-> 		free(fds);
#  174|   	signal(SIGINT, SIG_DFL);
#  175|   	raise(SIGINT);

Error: CPPCHECK_WARNING: [#def17]
psmisc-23.7-build/psmisc-23.7/src/prtstat.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def18]
psmisc-23.7-build/psmisc-23.7/src/pslog.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def19]
psmisc-23.7-build/psmisc-23.7/src/pstree.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING (CWE-401): [#def20]
psmisc-23.7-build/psmisc-23.7/src/pstree.c:374: error[memleakOnRealloc]: Common realloc mistake: 'width' nulled but not freed upon failure
#  372|           else
#  373|               capacity *= 2;
#  374|->         if (!(width = realloc(width, capacity * sizeof(int)))) {
#  375|               perror("realloc");
#  376|               exit(1);

Error: CPPCHECK_WARNING (CWE-401): [#def21]
psmisc-23.7-build/psmisc-23.7/src/pstree.c:378: error[memleakOnRealloc]: Common realloc mistake: 'more' nulled but not freed upon failure
#  376|               exit(1);
#  377|           }
#  378|->         if (!(more = realloc(more, capacity * sizeof(int)))) {
#  379|               perror("realloc");
#  380|               exit(1);

Error: CLANG_WARNING: [#def22]
psmisc-23.7-build/psmisc-23.7/src/pstree.c:521:9: warning[core.CallAndMessage]: Called function pointer is null (null dereference)
#  519|       if (my_getpidcon && selinux_enabled && !my_getpidcon(current->pid, &context)) {
#  520|           out_string(context);
#  521|->         my_freecon(context);
#  522|           ret = true;
#  523|       }

Error: CLANG_WARNING: [#def23]
psmisc-23.7-build/psmisc-23.7/src/pstree.c:918:9: warning[deadcode.DeadStores]: Value stored to 'count' is never read
#  916|       {
#  917|           width[level] = swapped + (comm_len > 1 ? 0 : -1);
#  918|->         count=0;
#  919|           first=1;
#  920|           for (walk = current->children; walk; walk = next) {

Error: CLANG_WARNING: [#def24]
psmisc-23.7-build/psmisc-23.7/src/pstree.c:919:9: warning[deadcode.DeadStores]: Value stored to 'first' is never read
#  917|           width[level] = swapped + (comm_len > 1 ? 0 : -1);
#  918|           count=0;
#  919|->         first=1;
#  920|           for (walk = current->children; walk; walk = next) {
#  921|             next = walk->next;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def25]
psmisc-23.7-build/psmisc-23.7/src/pstree.c: scope_hint: In function ‘read_proc’
psmisc-23.7-build/psmisc-23.7/src/pstree.c:1176:33: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(path, "r")’
psmisc-23.7-build/psmisc-23.7/src/pstree.c:41: included_from: Included from here.
# 1174|                 int thread;
# 1175|   
# 1176|-> 	      process_age_sec = process_age(proc_stt_jf);
# 1177|                 /* handle process threads */
# 1178|                 if (! hide_threads) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def26]
psmisc-23.7-build/psmisc-23.7/src/pstree.c:1176:33: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(path, "r")’
# 1174|                 int thread;
# 1175|   
# 1176|-> 	      process_age_sec = process_age(proc_stt_jf);
# 1177|                 /* handle process threads */
# 1178|                 if (! hide_threads) {

Error: CLANG_WARNING: [#def27]
psmisc-23.7-build/psmisc-23.7/src/pstree.c:1237:34: warning[core.NullDereference]: Array access (from variable 'buffer') results in a null pointer dereference
# 1235|                     size--;
# 1236|                   if (size)
# 1237|->                   buffer[size++] = 0;
# 1238|                   add_proc(comm, pid, ppid, pgid, st.st_uid,
# 1239|                        buffer, size, 0, process_age_sec);

Error: CLANG_WARNING: [#def28]
psmisc-23.7-build/psmisc-23.7/src/statx.c:63:11: warning[core.NonNullParamChecker]: Null pointer passed to 2nd parameter expecting 'nonnull'
#   61|       ret = syscall(SYS_statx, dirfd, pathname, flags, mask, &stx);
#   62|   #else
#   63|->     ret = statx(dirfd, pathname, flags, mask, &stx);
#   64|   #endif
#   65|       if (ret >= 0) {

Error: CLANG_WARNING: [#def29]
psmisc-23.7-build/psmisc-23.7/src/statx.c:134:11: warning[core.NonNullParamChecker]: Null pointer passed to 2nd parameter expecting 'nonnull'
#  132|       ret = syscall(SYS_statx, dirfd, pathname, flags, mask, &stx);
#  133|   #else
#  134|->     ret = statx(dirfd, pathname, flags, mask, &stx);
#  135|   #endif
#  136|       if (ret >= 0) {

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-112.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-namepsmisc-23.7-1.fc41
store-results-to/tmp/tmpbjg6nucu/psmisc-23.7-1.fc41.tar.xz
time-created2024-07-03 17:22:02
time-finished2024-07-03 17:23:06
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpbjg6nucu/psmisc-23.7-1.fc41.tar.xz' '--gcc-analyze' '/tmp/tmpbjg6nucu/psmisc-23.7-1.fc41.src.rpm'
tool-versioncsmock-3.5.3-1.el9