Task #119212 - fixed.err

back to task #119212
download
Error: SHELLCHECK_WARNING (CWE-457):
/usr/bin/blkdeactivate:151:23: warning[SC2154]: kname is referenced but not assigned (did you mean 'xname'?).
#  149|   
#  150|   add_device_to_skip_list() {
#  151|-> 	SKIP_DEVICE_LIST+=(["$kname"]=1)
#  152|   	return 1
#  153|   }

Error: SHELLCHECK_WARNING (CWE-457):
/usr/bin/blkdeactivate:168:11: warning[SC2154]: mnt is referenced but not assigned.
#  166|   
#  167|   device_umount_one() {
#  168|-> 	test -z "$mnt" && return 0
#  169|   
#  170|   	if test -z "${SKIP_UMOUNT_LIST["$mnt"]}" -a "$DO_UMOUNT" -eq "1"; then

Error: SHELLCHECK_WARNING (CWE-457):
/usr/bin/blkdeactivate:171:35: warning[SC2154]: name is referenced but not assigned (did you mean 'xname'?).
#  169|   
#  170|   	if test -z "${SKIP_UMOUNT_LIST["$mnt"]}" -a "$DO_UMOUNT" -eq "1"; then
#  171|-> 		echo -n "  [UMOUNT]: unmounting $name ($kname) mounted on $mnt... "
#  172|   		if eval "$UMOUNT" $UMOUNT_OPTS "$(printf "%s" "$mnt")" "$OUT" "$ERR"; then
#  173|   			echo "done"

Error: SHELLCHECK_WARNING (CWE-457):
/usr/bin/blkdeactivate:187:8: warning[SC2154]: devtype is referenced but not assigned.
#  185|   
#  186|   device_umount() {
#  187|-> 	test "$devtype" != "lvm" && test "${kname:0:3}" != "dm-" \
#  188|             && test "${kname:0:2}" != "md" && return 0
#  189|   

Error: SHELLCHECK_WARNING (CWE-140):
/usr/bin/lvm_import_vdo:207:19: warning[SC2207]: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
#  205|   	local initial_status
#  206|   
#  207|-> 	initial_status=( $("$DMSETUP" status "$VDO_DM_SNAPSHOT_NAME") )
#  208|   	"$DMSETUP" reload "$VDO_DM_SNAPSHOT_NAME" --table "$(snapshot_target_line_ "$1" "$VDO_SNAPSHOT_LOOP" -merge)"
#  209|   	"$DMSETUP" suspend "$VDO_DM_SNAPSHOT_NAME" || {

Error: SHELLCHECK_WARNING (CWE-140):
/usr/bin/lvm_import_vdo:225:12: warning[SC2207]: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
#  223|   	# FIXME: Recovery when something prevents merging is hard
#  224|   	for i in {1..20}; do
#  225|-> 		status=( $("$DMSETUP" status "$VDO_DM_SNAPSHOT_NAME") )
#  226|   		# Check if merging is finished
#  227|   		[ "${status[3]%/*}" = "${status[4]}" ] && break

Error: SHELLCHECK_WARNING:
/usr/bin/lvmdump:133:8: warning[SC2294]: eval negates the benefit of arrays. Drop eval to preserve whitespace/symbols (or eval as string).
#  131|   log() {
#  132|   	echo "$@" >> "$log"
#  133|-> 	eval "$@"
#  134|   }
#  135|   

Error: SHELLCHECK_WARNING (CWE-140):
/usr/bin/lvmpersist:171:9: warning[SC2207]: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
#  169|   	# sort with -u eliminates repeated keys listed with multipath
#  170|   
#  171|-> 	KEYS=( $($cmd $cmdopts --in --read-keys "$dev" 2>/dev/null | grep "    0x" | sort -u | xargs ) )
#  172|   
#  173|   	if [ "${PIPESTATUS[0]}" -ne "0" ]; then

Error: SHELLCHECK_WARNING (CWE-670):
/usr/bin/lvmpersist:856:13: warning[SC2128]: Expanding an array without an index only gives the first element.
#  854|   
#  855|   		get_key_list "$dev"
#  856|-> 		if [[ -n "$KEYS" ]]; then
#  857|   			logmsg "clear $GROUP keys not cleared from $dev - ${KEYS[*]}"
#  858|   			err=1

Error: SHELLCHECK_WARNING (CWE-140):
/usr/bin/lvmpersist:1379:12: warning[SC2207]: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
# 1377|   get_devices_from_vg() {
# 1378|   	local IFS=:
# 1379|-> 	DEVICES=( $("$LVM" vgs --nolocking --noheadings --separator : --sort pv_uuid --o pv_name --rows --config log/prefix=\"\" "$VGNAME") )
# 1380|   }
# 1381|   

Error: SHELLCHECK_WARNING (CWE-670):
/usr/bin/lvmpersist:1386:15: warning[SC2128]: Expanding an array without an index only gives the first element.
# 1384|   fi
# 1385|   
# 1386|-> FIRST_DEVICE="$DEVICES"
# 1387|   
# 1388|   if [[ -z "$FIRST_DEVICE" ]]; then

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2487:13: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(open("/dev/null", 2), 0)’
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2441:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2445:9: branch_false: ...to here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2479:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2482:9: branch_false: ...to here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2484:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2487:12: branch_false: ...to here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2487:12: branch_true: following ‘true’ branch...
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2487:44: branch_true: ...to here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2487:44: acquire_resource: opened here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2487:13: danger: ‘dup2(open("/dev/null", 2), 0)’ leaks here; was opened at [(11)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/10)
# 2485|   		exit(EXIT_DESC_OPEN_FAILURE);
# 2486|   
# 2487|-> 	if (((null_fd != STDIN_FILENO) && (dup2(null_fd, STDIN_FILENO) == -1)) ||
# 2488|   	    ((null_fd != STDOUT_FILENO) && (dup2(null_fd, STDOUT_FILENO) == -1)) ||
# 2489|   	    ((null_fd != STDERR_FILENO) && (dup2(null_fd, STDERR_FILENO) == -1))) {

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2487:13: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 2)’
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2441:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2445:9: branch_false: ...to here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2479:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2482:9: branch_false: ...to here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2484:24: acquire_resource: opened here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2484:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2487:12: branch_false: ...to here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2488:13: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2487:13: branch_false: ...to here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2487:13: danger: ‘open("/dev/null", 2)’ leaks here; was opened at [(7)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/6)
# 2485|   		exit(EXIT_DESC_OPEN_FAILURE);
# 2486|   
# 2487|-> 	if (((null_fd != STDIN_FILENO) && (dup2(null_fd, STDIN_FILENO) == -1)) ||
# 2488|   	    ((null_fd != STDOUT_FILENO) && (dup2(null_fd, STDOUT_FILENO) == -1)) ||
# 2489|   	    ((null_fd != STDERR_FILENO) && (dup2(null_fd, STDERR_FILENO) == -1))) {

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2488:13: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(open("/dev/null", 2), 1)’
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2441:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2445:9: branch_false: ...to here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2479:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2482:9: branch_false: ...to here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2484:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2487:12: branch_false: ...to here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2488:45: acquire_resource: opened here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2488:13: danger: ‘dup2(open("/dev/null", 2), 1)’ leaks here; was opened at [(9)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/8)
# 2486|   
# 2487|   	if (((null_fd != STDIN_FILENO) && (dup2(null_fd, STDIN_FILENO) == -1)) ||
# 2488|-> 	    ((null_fd != STDOUT_FILENO) && (dup2(null_fd, STDOUT_FILENO) == -1)) ||
# 2489|   	    ((null_fd != STDERR_FILENO) && (dup2(null_fd, STDERR_FILENO) == -1))) {
# 2490|   		if (null_fd > STDERR_FILENO)

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2489:13: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(open("/dev/null", 2), 2)’
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2441:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2445:9: branch_false: ...to here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2479:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2482:9: branch_false: ...to here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2484:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2487:12: branch_false: ...to here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2487:13: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2487:13: branch_false: ...to here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2489:45: acquire_resource: opened here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2489:13: danger: ‘dup2(open("/dev/null", 2), 2)’ leaks here; was opened at [(11)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/10)
# 2487|   	if (((null_fd != STDIN_FILENO) && (dup2(null_fd, STDIN_FILENO) == -1)) ||
# 2488|   	    ((null_fd != STDOUT_FILENO) && (dup2(null_fd, STDOUT_FILENO) == -1)) ||
# 2489|-> 	    ((null_fd != STDERR_FILENO) && (dup2(null_fd, STDERR_FILENO) == -1))) {
# 2490|   		if (null_fd > STDERR_FILENO)
# 2491|   			(void) close(null_fd);

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2490:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 2)’
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2441:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2445:9: branch_false: ...to here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2479:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2482:9: branch_false: ...to here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2484:24: acquire_resource: opened here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2484:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2487:12: branch_false: ...to here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2490:20: danger: ‘open("/dev/null", 2)’ leaks here; was opened at [(7)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/6)
# 2488|   	    ((null_fd != STDOUT_FILENO) && (dup2(null_fd, STDOUT_FILENO) == -1)) ||
# 2489|   	    ((null_fd != STDERR_FILENO) && (dup2(null_fd, STDERR_FILENO) == -1))) {
# 2490|-> 		if (null_fd > STDERR_FILENO)
# 2491|   			(void) close(null_fd);
# 2492|   		/* coverity[leaked_handle] null_fd is stdin/stdout/stderr */

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2496:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 2)’
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2441:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2445:9: branch_false: ...to here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2479:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2482:9: branch_false: ...to here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2484:24: acquire_resource: opened here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2484:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2487:12: branch_false: ...to here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2487:13: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2487:13: branch_false: ...to here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2489:13: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2496:12: branch_false: ...to here
LVM2.2.03.38/daemons/dmeventd/dmeventd.c:2496:12: danger: ‘open("/dev/null", 2)’ leaks here; was opened at [(7)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/6)
# 2494|   	}
# 2495|   
# 2496|-> 	if ((null_fd > STDERR_FILENO) && close(null_fd))
# 2497|   		exit(EXIT_DESC_CLOSE_FAILURE);
# 2498|   

Error: GCC_ANALYZER_WARNING (CWE-686):
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:123:38: warning[-Wanalyzer-va-arg-type-mismatch]: ‘va_arg’ expected ‘int *’ but received ‘long unsigned int’ for variadic argument 1 of ‘args’
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:698:12: enter_function: entry to ‘do_dump’
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:705:14: call_function: calling ‘setup_dump_socket’ from ‘do_dump’
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:705:14: return_function: returning to ‘do_dump’ from ‘setup_dump_socket’
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:706:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:711:17: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:713:12: branch_false: following ‘false’ branch (when ‘<unknown> == 0’)...
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:713:12: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:729:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:732:9: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:737:12: branch_false: following ‘false’ branch (when ‘rv >= 0’)...
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:742:9: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:749:13: branch_false: following ‘false’ branch (when the strings are non-equal)...
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:752:17: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:752:17: call_function: calling ‘format_info’ from ‘do_dump’
#  121|   				 * read an int (%d)
#  122|   				 */
#  123|-> 				int *dest = va_arg(args, int *);
#  124|   
#  125|   				if (sscanf(in, "%d%n", dest, &n) == 1) {

Error: GCC_ANALYZER_WARNING (CWE-686):
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:137:47: warning[-Wanalyzer-va-arg-type-mismatch]: ‘va_arg’ expected ‘unsigned int *’ but received ‘long unsigned int’ for variadic argument 1 of ‘args’
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:698:12: enter_function: entry to ‘do_dump’
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:705:14: call_function: calling ‘setup_dump_socket’ from ‘do_dump’
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:705:14: return_function: returning to ‘do_dump’ from ‘setup_dump_socket’
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:706:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:711:17: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:713:12: branch_false: following ‘false’ branch (when ‘<unknown> == 0’)...
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:713:12: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:729:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:732:9: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:737:12: branch_false: following ‘false’ branch (when ‘rv >= 0’)...
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:742:9: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:749:13: branch_false: following ‘false’ branch (when the strings are non-equal)...
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:752:17: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:752:17: call_function: calling ‘format_info’ from ‘do_dump’
#  135|   				 * read an unsigned int (%u)
#  136|   				 */
#  137|-> 				unsigned int *dest = va_arg(args, unsigned int *);
#  138|   
#  139|   				if (sscanf(in, "%u%n", dest, &n) == 1) {

Error: GCC_ANALYZER_WARNING:
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:828:13: warning[-Wanalyzer-fd-use-without-check]: ‘dup2’ on possibly invalid file descriptor ‘fd’
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:818:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:823:13: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:823:13: release_resource: closed here
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:823:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:828:13: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:828:13: danger: ‘fd’ could be invalid
#  826|   	}
#  827|   
#  828|-> 	if (dup2(null_fd, fd) == -1) {
#  829|   		log_error("dup2 error %d", errno);
#  830|   		goto out;

Error: GCC_ANALYZER_WARNING:
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:936:26: warning[-Wanalyzer-fd-use-without-check]: ‘dup2’ on possibly invalid file descriptor ‘1’
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:846:13: enter_function: entry to ‘_run_command_pipe’
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:859:21: branch_true: following ‘true’ branch (when ‘i != 33’)...
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:860:17: branch_true: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:907:12: branch_false: following ‘false’ branch (when ‘arg_len == 0’)...
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:915:13: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:915:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:920:15: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:922:12: branch_false: following ‘false’ branch (when ‘pid >= 0’)...
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:928:12: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:928:12: branch_true: following ‘true’ branch (when ‘pid == 0’)...
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:930:22: branch_true: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:930:22: call_function: calling ‘_reopen_fd_to_null’ from ‘_run_command_pipe’
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:930:22: return_function: returning to ‘_run_command_pipe’ from ‘_reopen_fd_to_null’
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:930:20: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:932:26: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:932:25: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:934:26: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:934:26: release_resource: closed here
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:934:25: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:936:26: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockctl.c:936:26: danger: ‘1’ could be invalid
#  934|   		else if (close(STDOUT_FILENO))
#  935|   			log_error("close error STDOUT %d", errno);
#  936|-> 		else if (dup2(pipefd[1 /*write*/], STDOUT_FILENO) == -1)
#  937|   			log_error("dup2 error STDOUT %d", errno);
#  938|   		else if (close(pipefd[1]))

Error: COMPILER_WARNING:
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-core.c: scope_hint: In function ‘clear_locks’
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-core.c:2548:13: warning[-Wunused-but-set-variable=]: variable ‘lk_count’ set but not used
# 2548 |         int lk_count = 0;
#      |             ^~~~~~~~
# 2546|   	uint32_t lk_version;
# 2547|   	uint32_t r_version;
# 2548|-> 	int lk_count = 0;
# 2549|   	int rv;
# 2550|   

Error: COMPILER_WARNING:
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-core.c: scope_hint: In function ‘lockspace_thread_main’
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-core.c:3374:9: warning[-Wstringop-truncation]: ‘strncpy’ specified bound 65 equals destination size
# 3374 |         strncpy(tmp_name+4, ls->name, sizeof(tmp_name)-4);
#      |         ^
# 3372|   	memset(tmp_name, 0, sizeof(tmp_name));
# 3373|   	memcpy(tmp_name, "REM:", 4);
# 3374|-> 	strncpy(tmp_name+4, ls->name, sizeof(tmp_name)-4);
# 3375|   	memcpy(ls->name, tmp_name, sizeof(ls->name));
# 3376|   	pthread_mutex_unlock(&lockspaces_mutex);

Error: COMPILER_WARNING:
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-core.c: scope_hint: In function ‘worker_thread_main’
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-core.c:7072:17: warning[-Wstringop-truncation]: ‘strncpy’ output may be truncated copying 64 bytes from a string of length 64
# 7072 |                 strncpy(msg.ls_name, ls_name, MAX_NAME);
#      |                 ^
# 7070|   
# 7071|   	if (act->op == LD_OP_FENCE) {
# 7072|-> 		strncpy(msg.ls_name, ls_name, MAX_NAME);
# 7073|   		msg.type = HELPER_COMMAND;
# 7074|   		msg.act = LD_OP_FENCE;

Error: GCC_ANALYZER_WARNING (CWE-121):
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-internal.h:304:9: warning[-Wanalyzer-out-of-bounds]: stack-based buffer overflow
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-core.c:6342:13: enter_function: entry to ‘adopt_locks’
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-core.c:6362:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-core.c:6371:33: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-core.c:6373:20: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-core.c:6377:37: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-core.c:6383:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-core.c:6392:14: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-core.c:6392:14: call_function: calling ‘read_adopt_file’ from ‘adopt_locks’
#  302|   	new->next = next;
#  303|   	new->prev = prev;
#  304|-> 	prev->next = new;
#  305|   }
#  306|   

Error: GCC_ANALYZER_WARNING (CWE-126):
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-internal.h:315:9: warning[-Wanalyzer-out-of-bounds]: stack-based buffer over-read
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-core.c:6342:13: enter_function: entry to ‘adopt_locks’
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-core.c:6362:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-core.c:6371:33: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-core.c:6373:20: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-core.c:6377:37: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-core.c:6383:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-core.c:6392:14: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-core.c:6392:14: call_function: calling ‘read_adopt_file’ from ‘adopt_locks’
#  313|   static inline void list_add(struct list_head *new, struct list_head *head)
#  314|   {
#  315|-> 	__list_add(new, head, head->next);
#  316|   }
#  317|   

Error: COMPILER_WARNING:
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c: scope_hint: In function ‘lm_init_vg_sanlock’
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:723:13: warning[-Wunused-but-set-variable=]: variable ‘i’ set but not used
#  723 |         int i, rv;
#      |             ^
#  721|   	int align_size = 0;
#  722|   	int align_mb = 0;
#  723|-> 	int i, rv;
#  724|   
#  725|   	if (other_args && (lockd_lockargs_get_user_flags(other_args, &lock_args_flags) < 0)) {

Error: COMPILER_WARNING:
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c: scope_hint: In function ‘lm_rename_vg_sanlock’
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:1108:13: warning[-Wunused-but-set-variable=]: variable ‘i’ set but not used
# 1108 |         int i, rv;
#      |             ^
# 1106|   	int sector_size = 0;
# 1107|   	int align_size = 0;
# 1108|-> 	int i, rv;
# 1109|   
# 1110|   	memset(&disk, 0, sizeof(disk));

Error: GCC_ANALYZER_WARNING (CWE-126):
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:1728:25: warning[-Wanalyzer-out-of-bounds]: stack-based buffer over-read
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:1625:5: enter_function: entry to ‘lm_prepare_lockspace_sanlock’
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:1661:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:1666:14: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:1666:14: call_function: calling ‘lockd_lockargs_get_locklv’ from ‘lm_prepare_lockspace_sanlock’
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:1666:14: return_function: returning to ‘lm_prepare_lockspace_sanlock’ from ‘lockd_lockargs_get_locklv’
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:1667:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:1674:20: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:1674:20: call_function: calling ‘build_dm_path’ from ‘lm_prepare_lockspace_sanlock’
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:1674:20: return_function: returning to ‘lm_prepare_lockspace_sanlock’ from ‘build_dm_path’
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:1674:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:1689:9: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:1692:12: branch_false: following ‘false’ branch (when ‘rv >= 0’)...
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:1699:14: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:1706:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:1713:15: call_function: inlined call to ‘zalloc’ from ‘lm_prepare_lockspace_sanlock’
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:1714:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:1719:9: branch_false: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:1726:12: branch_true: following ‘true’ branch...
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:1727:22: branch_true: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:1727:20: branch_true: following ‘true’ branch...
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:1728:25: branch_true: ...to here
LVM2.2.03.38/daemons/lvmlockd/lvmlockd-sanlock.c:1728:25: danger: out-of-bounds read from byte 49 till byte 63 but ‘lsname’ ends at byte 49
# 1726|   	if (daemon_test) {
# 1727|   		if (!gl_lsname_sanlock[0]) {
# 1728|-> 			strncpy(gl_lsname_sanlock, lsname, MAX_NAME);
# 1729|   			log_debug("S %s prepare_lockspace_san use global lock", lsname);
# 1730|   		}

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-core.c:414:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(outfd, 1)’
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-core.c:388:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-core.c:393:14: branch_false: ...to here
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-core.c:393:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-core.c:410:12: branch_true: following ‘true’ branch (when ‘r == 0’)...
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-core.c:414:22: branch_true: ...to here
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-core.c:414:22: acquire_resource: opened here
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-core.c:414:20: danger: ‘dup2(outfd, 1)’ leaks here; was opened at [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6)
#  412|   		/* !!! Do not touch any posix thread primitives !!! */
#  413|   
#  414|-> 		if ((dup2(outfd, STDOUT_FILENO ) != STDOUT_FILENO) ||
#  415|   		    (dup2(errfd, STDERR_FILENO ) != STDERR_FILENO))
#  416|   			_exit(LVMPD_RET_DUP_FAILED);

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-core.c:414:21: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(errfd, 2)’
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-core.c:388:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-core.c:393:14: branch_false: ...to here
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-core.c:393:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-core.c:410:12: branch_true: following ‘true’ branch (when ‘r == 0’)...
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-core.c:414:22: branch_true: ...to here
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-core.c:414:20: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-core.c:415:22: branch_false: ...to here
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-core.c:415:22: acquire_resource: opened here
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-core.c:414:21: danger: ‘dup2(errfd, 2)’ leaks here; was opened at [(9)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/8)
#  412|   		/* !!! Do not touch any posix thread primitives !!! */
#  413|   
#  414|-> 		if ((dup2(outfd, STDOUT_FILENO ) != STDOUT_FILENO) ||
#  415|   		    (dup2(errfd, STDERR_FILENO ) != STDERR_FILENO))
#  416|   			_exit(LVMPD_RET_DUP_FAILED);

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-data-utils.c:401:9: warning[-Wanalyzer-fd-leak]: leak of file descriptor
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-data-utils.c:331:30: enter_function: entry to ‘lvmpolld_thread_data_constructor’
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-data-utils.c:334:12: branch_false: following ‘false’ branch (when ‘data’ is non-NULL)...
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-data-utils.c:337:9: branch_false: ...to here
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-data-utils.c:343:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-data-utils.c:343:41: branch_false: ...to here
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-data-utils.c:343:13: branch_true: following ‘true’ branch...
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-data-utils.c:344:17: branch_true: ...to here
LVM2.2.03.38/daemons/lvmpolld/lvmpolld-data-utils.c:344:17: call_function: calling ‘lvmpolld_thread_data_destroy’ from ‘lvmpolld_thread_data_constructor’
#  399|   		(void) close(data->errpipe[1]);
#  400|   
#  401|-> 	free(data);
#  402|   }

Error: CPPCHECK_WARNING (CWE-457):
LVM2.2.03.38/device_mapper/ioctl/libdm-iface.c:814: error[legacyUninitvar]: Uninitialized variable: names1
#  812|   	/* buffer for devs +  sorted ptrs + dm_devs + aligned strings */
#  813|   	if (!(devs = malloc(sizeof(*devs) + cnt * (2 * sizeof(void*) + sizeof(*dm_dev)) +
#  814|-> 			    (cnt ? (char*)names1 - (char*)names + 256 : 0))))
#  815|   		return_0;
#  816|   

Error: COMPILER_WARNING:
LVM2.2.03.38/lib/activate/dev_manager.c: scope_hint: In function ‘add_areas_line’
LVM2.2.03.38/lib/activate/dev_manager.c:3031:18: warning[-Wunused-but-set-variable=]: variable ‘num_existing_areas’ set but not used
# 3031 |         unsigned num_existing_areas = 0;
#      |                  ^~~~~~~~~~~~~~~~~~
# 3029|   	const char *name;
# 3030|   	unsigned num_error_areas = 0;
# 3031|-> 	unsigned num_existing_areas = 0;
# 3032|   
# 3033|   	for (s = start_area; s < areas; s++) {

Error: CPPCHECK_WARNING (CWE-476):
LVM2.2.03.38/lib/cache/lvmcache.c:298: warning[nullPointer]: Possible null pointer dereference: vgname
#  296|   	} else {
#  297|   		dm_list_iterate_items(vginfo, &_vginfos) {
#  298|-> 			if (!strcmp(vgname, vginfo->vgname))
#  299|   				return vginfo;
#  300|   		}

Error: GCC_ANALYZER_WARNING (CWE-401):
LVM2.2.03.38/lib/cache/lvmcache.c:2035:12: warning[-Wanalyzer-malloc-leak]: leak of ‘strdup(lock_type)’
LVM2.2.03.38/lib/cache/lvmcache.c:2086:5: enter_function: entry to ‘lvmcache_update_vgname_and_id’
LVM2.2.03.38/lib/cache/lvmcache.c:2116:14: call_function: calling ‘_lvmcache_update_vgname’ from ‘lvmcache_update_vgname_and_id’
LVM2.2.03.38/lib/cache/lvmcache.c:2116:14: return_function: returning to ‘lvmcache_update_vgname_and_id’ from ‘_lvmcache_update_vgname’
LVM2.2.03.38/lib/cache/lvmcache.c:2116:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/cache/lvmcache.c:2125:14: branch_false: ...to here
LVM2.2.03.38/lib/cache/lvmcache.c:2125:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/cache/lvmcache.c:2139:14: branch_false: ...to here
LVM2.2.03.38/lib/cache/lvmcache.c:2159:17: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/cache/lvmcache.c:2162:14: branch_false: ...to here
LVM2.2.03.38/lib/cache/lvmcache.c:2162:12: branch_true: following ‘true’ branch...
LVM2.2.03.38/lib/cache/lvmcache.c:2163:39: branch_true: ...to here
LVM2.2.03.38/lib/cache/lvmcache.c:2181:12: branch_false: following ‘false’ branch (when ‘vginfo’ is non-NULL)...
LVM2.2.03.38/lib/cache/lvmcache.c:2184:14: branch_false: ...to here
LVM2.2.03.38/lib/cache/lvmcache.c:2184:12: branch_true: following ‘true’ branch...
LVM2.2.03.38/lib/cache/lvmcache.c:2185:33: branch_true: ...to here
LVM2.2.03.38/lib/cache/lvmcache.c:2247:14: call_function: calling ‘_lvmcache_update_vgstatus’ from ‘lvmcache_update_vgname_and_id’
# 2033|   	free(info->vginfo->lock_type);
# 2034|   
# 2035|-> 	if (!(info->vginfo->lock_type = strdup(lock_type))) {
# 2036|   		log_error("cache lock_type alloc failed for %s", lock_type);
# 2037|   		return 0;

Error: GCC_ANALYZER_WARNING (CWE-835):
LVM2.2.03.38/lib/device/dev-type.c:288:24: warning[-Wanalyzer-infinite-loop]: infinite loop
LVM2.2.03.38/lib/device/dev-type.c:288:24: danger: infinite loop here
LVM2.2.03.38/lib/device/dev-type.c:288:24: branch_true: if it ever follows ‘true’ branch, it will always do so...
LVM2.2.03.38/lib/device/dev-type.c:289:25: branch_true: ...to here
#  286|   
#  287|   		/* Find the start of the device major name */
#  288|-> 		while (line[i] != ' ' && line[i] != '\0')
#  289|   			i++;
#  290|   		while (line[i] == ' ')

Error: COMPILER_WARNING:
LVM2.2.03.38/lib/device/persist.c: scope_hint: In function ‘persist_start_extend’
LVM2.2.03.38/lib/device/persist.c:2323:13: warning[-Wunused-but-set-variable=]: variable ‘y’ set but not used
# 2323 |         int y = 0;
#      |             ^
# 2321|   	int errors = 0;
# 2322|   	int found = 0;
# 2323|-> 	int y = 0;
# 2324|   	int n = 0;
# 2325|   

Error: GCC_ANALYZER_WARNING (CWE-401):
LVM2.2.03.38/lib/label/hints.c:859:17: warning[-Wanalyzer-malloc-leak]: leak of ‘calloc(1, 4288)’
LVM2.2.03.38/lib/label/hints.c:691:12: enter_function: entry to ‘_read_hint_file’
LVM2.2.03.38/lib/label/hints.c:713:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/label/hints.c:716:9: branch_false: ...to here
LVM2.2.03.38/lib/label/hints.c:718:21: branch_true: following ‘true’ branch (when ‘i != 4’)...
LVM2.2.03.38/lib/label/hints.c:719:17: branch_true: ...to here
LVM2.2.03.38/lib/label/hints.c:721:16: branch_true: following ‘true’ branch...
LVM2.2.03.38/lib/label/hints.c:722:17: branch_true: ...to here
LVM2.2.03.38/lib/label/hints.c:726:20: branch_false: following ‘false’ branch (when ‘p’ is NULL)...
LVM2.2.03.38/lib/label/hints.c:740:22: branch_false: ...to here
LVM2.2.03.38/lib/label/hints.c:740:20: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/label/hints.c:757:22: branch_false: ...to here
LVM2.2.03.38/lib/label/hints.c:757:20: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/label/hints.c:770:22: branch_false: ...to here
LVM2.2.03.38/lib/label/hints.c:770:20: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/label/hints.c:783:22: branch_false: ...to here
LVM2.2.03.38/lib/label/hints.c:783:20: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/label/hints.c:795:22: branch_false: ...to here
LVM2.2.03.38/lib/label/hints.c:795:20: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/label/hints.c:814:22: branch_false: ...to here
LVM2.2.03.38/lib/label/hints.c:814:20: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/label/hints.c:827:21: branch_false: ...to here
LVM2.2.03.38/lib/label/hints.c:827:20: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/label/hints.c:830:21: branch_false: ...to here
LVM2.2.03.38/lib/label/hints.c:830:20: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/label/hints.c:833:17: branch_false: ...to here
LVM2.2.03.38/lib/label/hints.c:853:36: call_function: inlined call to ‘zalloc’ from ‘_read_hint_file’
LVM2.2.03.38/lib/label/hints.c:853:20: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/label/hints.c:857:17: branch_false: ...to here
LVM2.2.03.38/lib/label/hints.c:859:17: danger: ‘calloc(1, 4288)’ leaks here; was allocated at [(28)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/27)
#  857|   		memcpy(alloc_hint, &hint, sizeof(hint));
#  858|   
#  859|-> 		log_debug("add hint %s %s %d:%d %s", hint.name, hint.pvid, major, minor, vgname);
#  860|   		dm_list_add(hints, &alloc_hint->list);
#  861|   		found++;

Error: COMPILER_WARNING:
LVM2.2.03.38/lib/metadata/integrity_manip.c:535:38: warning[-Wunused-but-set-variable=]: variable ‘lbs_unknown’ set but not used
#  535 |         int lbs_4k = 0, lbs_512 = 0, lbs_unknown = 0;
#      |                                      ^~~~~~~~~~~
#  533|   	uint32_t area_count, s;
#  534|   	uint32_t revert_meta_lvs = 0;
#  535|-> 	int lbs_4k = 0, lbs_512 = 0, lbs_unknown = 0;
#  536|   	int pbs_4k = 0, pbs_512 = 0, pbs_unknown = 0;
#  537|   	int is_active;

Error: COMPILER_WARNING:
LVM2.2.03.38/lib/metadata/integrity_manip.c: scope_hint: In function ‘lv_add_integrity_to_raid’
LVM2.2.03.38/lib/metadata/integrity_manip.c:536:38: warning[-Wunused-but-set-variable=]: variable ‘pbs_unknown’ set but not used
#  536 |         int pbs_4k = 0, pbs_512 = 0, pbs_unknown = 0;
#      |                                      ^~~~~~~~~~~
#  534|   	uint32_t revert_meta_lvs = 0;
#  535|   	int lbs_4k = 0, lbs_512 = 0, lbs_unknown = 0;
#  536|-> 	int pbs_4k = 0, pbs_512 = 0, pbs_unknown = 0;
#  537|   	int is_active;
#  538|   	int r;

Error: GCC_ANALYZER_WARNING (CWE-121):
LVM2.2.03.38/lib/metadata/mirror.c:1739:9: warning[-Wanalyzer-out-of-bounds]: stack-based buffer overflow
LVM2.2.03.38/lib/metadata/mirror.c:1876:5: enter_function: entry to ‘add_mirror_log’
LVM2.2.03.38/lib/metadata/mirror.c:1896:12: branch_false: following ‘false’ branch (when ‘old_log_count != log_count’)...
LVM2.2.03.38/lib/metadata/mirror.c:1903:12: branch_false: ...to here
LVM2.2.03.38/lib/metadata/mirror.c:1912:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/metadata/mirror.c:1915:25: branch_false: ...to here
LVM2.2.03.38/lib/metadata/mirror.c:1915:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/metadata/mirror.c:1918:13: branch_false: ...to here
LVM2.2.03.38/lib/metadata/mirror.c:1926:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/metadata/mirror.c:1934:12: branch_false: ...to here
LVM2.2.03.38/lib/metadata/mirror.c:1934:12: branch_true: following ‘true’ branch (when ‘old_log_count != 0’)...
LVM2.2.03.38/lib/metadata/mirror.c:1936:22: branch_true: ...to here
LVM2.2.03.38/lib/metadata/mirror.c:1936:22: call_function: calling ‘_form_mirror’ from ‘add_mirror_log’
# 1737|   	 */
# 1738|   	img_lvs = alloca(sizeof(*img_lvs) * (mirrors + 1));
# 1739|-> 	memset(img_lvs, 0, sizeof(*img_lvs) * mirrors);
# 1740|   
# 1741|   	if (!_create_mimage_lvs(ah, mirrors, stripes, stripe_size, lv, img_lvs, log))

Error: COMPILER_WARNING:
LVM2.2.03.38/lib/metadata/raid_manip.c: scope_hint: In function ‘_reorder_raid10_near_seg_areas’
LVM2.2.03.38/lib/metadata/raid_manip.c:769:18: warning[-Wunused-but-set-variable=]: variable ‘i’ set but not used
#  769 |         unsigned i = 0;
#      |                  ^
#  767|   	uint32_t data_copies = seg->data_copies;
#  768|   	uint32_t *idx, stripes = seg->area_count;
#  769|-> 	unsigned i = 0;
#  770|   
#  771|   	if (!stripes) {

Error: GCC_ANALYZER_WARNING (CWE-835):
LVM2.2.03.38/lib/metadata/raid_manip.c:881:17: warning[-Wanalyzer-infinite-loop]: infinite loop
#  879|   	/* Sort areas */
#  880|   	do {
#  881|-> 		xchg = seg->area_count;
#  882|   
#  883|   		for (s = 0; s < seg->area_count ; s++)

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.38/lib/misc/lvm-exec.c:129:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(open("/dev/null", 2), fd)’
LVM2.2.03.38/lib/misc/lvm-exec.c:119:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/misc/lvm-exec.c:124:12: branch_false: ...to here
LVM2.2.03.38/lib/misc/lvm-exec.c:124:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/misc/lvm-exec.c:129:13: branch_false: ...to here
LVM2.2.03.38/lib/misc/lvm-exec.c:129:13: acquire_resource: opened here
LVM2.2.03.38/lib/misc/lvm-exec.c:129:12: danger: ‘dup2(open("/dev/null", 2), fd)’ leaks here; was opened at [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4)
#  127|   	}
#  128|   
#  129|-> 	if (dup2(null_fd, fd) == -1) {
#  130|   		log_sys_error("dup2", "");
#  131|   		goto out;

Error: GCC_ANALYZER_WARNING:
LVM2.2.03.38/lib/misc/lvm-exec.c:129:13: warning[-Wanalyzer-fd-use-without-check]: ‘dup2’ on possibly invalid file descriptor ‘fd’
LVM2.2.03.38/lib/misc/lvm-exec.c:119:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/misc/lvm-exec.c:124:12: branch_false: ...to here
LVM2.2.03.38/lib/misc/lvm-exec.c:124:12: branch_true: following ‘true’ branch...
LVM2.2.03.38/lib/misc/lvm-exec.c:124:32: branch_true: ...to here
LVM2.2.03.38/lib/misc/lvm-exec.c:124:32: release_resource: closed here
LVM2.2.03.38/lib/misc/lvm-exec.c:124:13: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/misc/lvm-exec.c:129:13: branch_false: ...to here
LVM2.2.03.38/lib/misc/lvm-exec.c:129:13: danger: ‘fd’ could be invalid
#  127|   	}
#  128|   
#  129|-> 	if (dup2(null_fd, fd) == -1) {
#  130|   		log_sys_error("dup2", "");
#  131|   		goto out;

Error: GCC_ANALYZER_WARNING:
LVM2.2.03.38/lib/misc/lvm-exec.c:178:26: warning[-Wanalyzer-fd-use-without-check]: ‘dup2’ on possibly invalid file descriptor ‘1’
LVM2.2.03.38/lib/misc/lvm-exec.c:144:7: enter_function: entry to ‘pipe_open’
LVM2.2.03.38/lib/misc/lvm-exec.c:154:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/misc/lvm-exec.c:159:9: branch_false: ...to here
LVM2.2.03.38/lib/misc/lvm-exec.c:161:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/misc/lvm-exec.c:170:12: branch_false: ...to here
LVM2.2.03.38/lib/misc/lvm-exec.c:170:12: branch_true: following ‘true’ branch...
LVM2.2.03.38/lib/misc/lvm-exec.c:172:22: branch_true: ...to here
LVM2.2.03.38/lib/misc/lvm-exec.c:172:22: call_function: calling ‘_reopen_fd_to_null’ from ‘pipe_open’
LVM2.2.03.38/lib/misc/lvm-exec.c:172:22: return_function: returning to ‘pipe_open’ from ‘_reopen_fd_to_null’
LVM2.2.03.38/lib/misc/lvm-exec.c:172:20: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/misc/lvm-exec.c:174:26: branch_false: ...to here
LVM2.2.03.38/lib/misc/lvm-exec.c:174:25: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/misc/lvm-exec.c:176:26: branch_false: ...to here
LVM2.2.03.38/lib/misc/lvm-exec.c:176:26: release_resource: closed here
LVM2.2.03.38/lib/misc/lvm-exec.c:176:25: branch_false: following ‘false’ branch...
LVM2.2.03.38/lib/misc/lvm-exec.c:178:26: branch_false: ...to here
LVM2.2.03.38/lib/misc/lvm-exec.c:178:26: danger: ‘1’ could be invalid
#  176|   		else if (close(STDOUT_FILENO))
#  177|   			log_sys_error("close", "STDOUT");
#  178|-> 		else if (dup2(pipefd[1 /*write*/], STDOUT_FILENO) == -1)
#  179|   			log_sys_error("dup2", "STDOUT");
#  180|   		else if (close(pipefd[1]))

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.38/libdaemon/server/daemon-server.c:389:13: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(open("/dev/null", 2), 0)’
LVM2.2.03.38/libdaemon/server/daemon-server.c:338:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdaemon/server/daemon-server.c:343:9: branch_false: ...to here
LVM2.2.03.38/libdaemon/server/daemon-server.c:344:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdaemon/server/daemon-server.c:349:9: branch_false: ...to here
LVM2.2.03.38/libdaemon/server/daemon-server.c:383:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdaemon/server/daemon-server.c:389:12: branch_false: ...to here
LVM2.2.03.38/libdaemon/server/daemon-server.c:389:12: branch_true: following ‘true’ branch...
LVM2.2.03.38/libdaemon/server/daemon-server.c:389:39: branch_true: ...to here
LVM2.2.03.38/libdaemon/server/daemon-server.c:389:39: acquire_resource: opened here
LVM2.2.03.38/libdaemon/server/daemon-server.c:389:13: danger: ‘dup2(open("/dev/null", 2), 0)’ leaks here; was opened at [(11)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/10)
#  387|   	}
#  388|   
#  389|-> 	if (((fd != STDIN_FILENO) && (dup2(fd, STDIN_FILENO) == -1)) ||
#  390|   	    ((fd != STDOUT_FILENO) && (dup2(fd, STDOUT_FILENO) == -1)) ||
#  391|   	    ((fd != STDERR_FILENO) && (dup2(fd, STDERR_FILENO) == -1))) {

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.38/libdaemon/server/daemon-server.c:389:13: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 2)’
LVM2.2.03.38/libdaemon/server/daemon-server.c:338:19: acquire_resource: opened here
LVM2.2.03.38/libdaemon/server/daemon-server.c:338:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdaemon/server/daemon-server.c:343:9: branch_false: ...to here
LVM2.2.03.38/libdaemon/server/daemon-server.c:344:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdaemon/server/daemon-server.c:349:9: branch_false: ...to here
LVM2.2.03.38/libdaemon/server/daemon-server.c:383:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdaemon/server/daemon-server.c:389:12: branch_false: ...to here
LVM2.2.03.38/libdaemon/server/daemon-server.c:390:13: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdaemon/server/daemon-server.c:389:13: branch_false: ...to here
LVM2.2.03.38/libdaemon/server/daemon-server.c:389:13: danger: ‘open("/dev/null", 2)’ leaks here; was opened at [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#  387|   	}
#  388|   
#  389|-> 	if (((fd != STDIN_FILENO) && (dup2(fd, STDIN_FILENO) == -1)) ||
#  390|   	    ((fd != STDOUT_FILENO) && (dup2(fd, STDOUT_FILENO) == -1)) ||
#  391|   	    ((fd != STDERR_FILENO) && (dup2(fd, STDERR_FILENO) == -1))) {

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.38/libdaemon/server/daemon-server.c:390:13: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(open("/dev/null", 2), 1)’
LVM2.2.03.38/libdaemon/server/daemon-server.c:338:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdaemon/server/daemon-server.c:343:9: branch_false: ...to here
LVM2.2.03.38/libdaemon/server/daemon-server.c:344:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdaemon/server/daemon-server.c:349:9: branch_false: ...to here
LVM2.2.03.38/libdaemon/server/daemon-server.c:383:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdaemon/server/daemon-server.c:389:12: branch_false: ...to here
LVM2.2.03.38/libdaemon/server/daemon-server.c:390:40: acquire_resource: opened here
LVM2.2.03.38/libdaemon/server/daemon-server.c:390:13: danger: ‘dup2(open("/dev/null", 2), 1)’ leaks here; was opened at [(9)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/8)
#  388|   
#  389|   	if (((fd != STDIN_FILENO) && (dup2(fd, STDIN_FILENO) == -1)) ||
#  390|-> 	    ((fd != STDOUT_FILENO) && (dup2(fd, STDOUT_FILENO) == -1)) ||
#  391|   	    ((fd != STDERR_FILENO) && (dup2(fd, STDERR_FILENO) == -1))) {
#  392|   		perror("Error setting terminal FDs to /dev/null");

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.38/libdaemon/server/daemon-server.c:391:13: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(open("/dev/null", 2), 2)’
LVM2.2.03.38/libdaemon/server/daemon-server.c:338:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdaemon/server/daemon-server.c:343:9: branch_false: ...to here
LVM2.2.03.38/libdaemon/server/daemon-server.c:344:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdaemon/server/daemon-server.c:349:9: branch_false: ...to here
LVM2.2.03.38/libdaemon/server/daemon-server.c:383:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdaemon/server/daemon-server.c:389:12: branch_false: ...to here
LVM2.2.03.38/libdaemon/server/daemon-server.c:389:13: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdaemon/server/daemon-server.c:389:13: branch_false: ...to here
LVM2.2.03.38/libdaemon/server/daemon-server.c:391:40: acquire_resource: opened here
LVM2.2.03.38/libdaemon/server/daemon-server.c:391:13: danger: ‘dup2(open("/dev/null", 2), 2)’ leaks here; was opened at [(11)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/10)
#  389|   	if (((fd != STDIN_FILENO) && (dup2(fd, STDIN_FILENO) == -1)) ||
#  390|   	    ((fd != STDOUT_FILENO) && (dup2(fd, STDOUT_FILENO) == -1)) ||
#  391|-> 	    ((fd != STDERR_FILENO) && (dup2(fd, STDERR_FILENO) == -1))) {
#  392|   		perror("Error setting terminal FDs to /dev/null");
#  393|   		if (fd > STDERR_FILENO)

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.38/libdaemon/server/daemon-server.c:393:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 2)’
LVM2.2.03.38/libdaemon/server/daemon-server.c:338:19: acquire_resource: opened here
LVM2.2.03.38/libdaemon/server/daemon-server.c:338:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdaemon/server/daemon-server.c:343:9: branch_false: ...to here
LVM2.2.03.38/libdaemon/server/daemon-server.c:344:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdaemon/server/daemon-server.c:349:9: branch_false: ...to here
LVM2.2.03.38/libdaemon/server/daemon-server.c:383:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdaemon/server/daemon-server.c:389:12: branch_false: ...to here
LVM2.2.03.38/libdaemon/server/daemon-server.c:393:20: danger: ‘open("/dev/null", 2)’ leaks here; was opened at [(1)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/0)
#  391|   	    ((fd != STDERR_FILENO) && (dup2(fd, STDERR_FILENO) == -1))) {
#  392|   		perror("Error setting terminal FDs to /dev/null");
#  393|-> 		if (fd > STDERR_FILENO)
#  394|   			(void) close(fd);
#  395|   		/* coverity[leaked_handle] fd is stdin/stdout/stderr */

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.38/libdaemon/server/daemon-server.c:399:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 2)’
LVM2.2.03.38/libdaemon/server/daemon-server.c:338:19: acquire_resource: opened here
LVM2.2.03.38/libdaemon/server/daemon-server.c:338:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdaemon/server/daemon-server.c:343:9: branch_false: ...to here
LVM2.2.03.38/libdaemon/server/daemon-server.c:344:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdaemon/server/daemon-server.c:349:9: branch_false: ...to here
LVM2.2.03.38/libdaemon/server/daemon-server.c:383:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdaemon/server/daemon-server.c:389:12: branch_false: ...to here
LVM2.2.03.38/libdaemon/server/daemon-server.c:389:13: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdaemon/server/daemon-server.c:389:13: branch_false: ...to here
LVM2.2.03.38/libdaemon/server/daemon-server.c:391:13: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdaemon/server/daemon-server.c:399:12: branch_false: ...to here
LVM2.2.03.38/libdaemon/server/daemon-server.c:399:12: danger: ‘open("/dev/null", 2)’ leaks here; was opened at [(1)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/0)
#  397|   	}
#  398|   
#  399|-> 	if ((fd > STDERR_FILENO) && close(fd)) {
#  400|   		perror("Failed to close /dev/null descriptor");
#  401|   		exit(3);

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:664:21: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(open("/dev/null", 2), 0)’
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:816:5: enter_function: entry to ‘main’
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:820:14: call_function: calling ‘_parse_args’ from ‘main’
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:820:14: return_function: returning to ‘main’ from ‘_parse_args’
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:820:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:825:9: branch_false: ...to here
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:831:12: branch_true: following ‘true’ branch...
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:831:30: branch_true: ...to here
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:831:30: call_function: calling ‘_daemonize’ from ‘main’
#  662|   		}
#  663|   
#  664|-> 		if (((fd != STDIN_FILENO) && (dup2(fd, STDIN_FILENO) == -1)) ||
#  665|   		    ((fd != STDOUT_FILENO) && (dup2(fd, STDOUT_FILENO) == -1)) ||
#  666|   		    ((fd != STDERR_FILENO) && (dup2(fd, STDERR_FILENO) == -1))) {

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:664:21: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 2)’
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:816:5: enter_function: entry to ‘main’
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:820:14: call_function: calling ‘_parse_args’ from ‘main’
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:820:14: return_function: returning to ‘main’ from ‘_parse_args’
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:820:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:825:9: branch_false: ...to here
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:831:12: branch_true: following ‘true’ branch...
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:831:30: branch_true: ...to here
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:831:30: call_function: calling ‘_daemonize’ from ‘main’
#  662|   		}
#  663|   
#  664|-> 		if (((fd != STDIN_FILENO) && (dup2(fd, STDIN_FILENO) == -1)) ||
#  665|   		    ((fd != STDOUT_FILENO) && (dup2(fd, STDOUT_FILENO) == -1)) ||
#  666|   		    ((fd != STDERR_FILENO) && (dup2(fd, STDERR_FILENO) == -1))) {

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:665:21: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(open("/dev/null", 2), 1)’
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:816:5: enter_function: entry to ‘main’
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:820:14: call_function: calling ‘_parse_args’ from ‘main’
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:820:14: return_function: returning to ‘main’ from ‘_parse_args’
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:820:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:825:9: branch_false: ...to here
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:831:12: branch_true: following ‘true’ branch...
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:831:30: branch_true: ...to here
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:831:30: call_function: calling ‘_daemonize’ from ‘main’
#  663|   
#  664|   		if (((fd != STDIN_FILENO) && (dup2(fd, STDIN_FILENO) == -1)) ||
#  665|-> 		    ((fd != STDOUT_FILENO) && (dup2(fd, STDOUT_FILENO) == -1)) ||
#  666|   		    ((fd != STDERR_FILENO) && (dup2(fd, STDERR_FILENO) == -1))) {
#  667|   			if (fd > STDERR_FILENO)

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:666:21: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(open("/dev/null", 2), 2)’
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:816:5: enter_function: entry to ‘main’
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:820:14: call_function: calling ‘_parse_args’ from ‘main’
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:820:14: return_function: returning to ‘main’ from ‘_parse_args’
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:820:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:825:9: branch_false: ...to here
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:831:12: branch_true: following ‘true’ branch...
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:831:30: branch_true: ...to here
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:831:30: call_function: calling ‘_daemonize’ from ‘main’
#  664|   		if (((fd != STDIN_FILENO) && (dup2(fd, STDIN_FILENO) == -1)) ||
#  665|   		    ((fd != STDOUT_FILENO) && (dup2(fd, STDOUT_FILENO) == -1)) ||
#  666|-> 		    ((fd != STDERR_FILENO) && (dup2(fd, STDERR_FILENO) == -1))) {
#  667|   			if (fd > STDERR_FILENO)
#  668|   				(void) close(fd);

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:667:28: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 2)’
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:816:5: enter_function: entry to ‘main’
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:820:14: call_function: calling ‘_parse_args’ from ‘main’
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:820:14: return_function: returning to ‘main’ from ‘_parse_args’
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:820:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:825:9: branch_false: ...to here
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:831:12: branch_true: following ‘true’ branch...
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:831:30: branch_true: ...to here
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:831:30: call_function: calling ‘_daemonize’ from ‘main’
#  665|   		    ((fd != STDOUT_FILENO) && (dup2(fd, STDOUT_FILENO) == -1)) ||
#  666|   		    ((fd != STDERR_FILENO) && (dup2(fd, STDERR_FILENO) == -1))) {
#  667|-> 			if (fd > STDERR_FILENO)
#  668|   				(void) close(fd);
#  669|   			_early_log("Error redirecting stdin/out/err to null.");

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:673:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 2)’
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:816:5: enter_function: entry to ‘main’
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:820:14: call_function: calling ‘_parse_args’ from ‘main’
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:820:14: return_function: returning to ‘main’ from ‘_parse_args’
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:820:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:825:9: branch_false: ...to here
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:831:12: branch_true: following ‘true’ branch...
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:831:30: branch_true: ...to here
LVM2.2.03.38/libdm/dm-tools/dmfilemapd.c:831:30: call_function: calling ‘_daemonize’ from ‘main’
#  671|   			return 0;
#  672|   		}
#  673|-> 		if (fd > STDERR_FILENO)
#  674|   			(void) close(fd);
#  675|   	}

Error: CPPCHECK_WARNING (CWE-758):
LVM2.2.03.38/libdm/dm-tools/dmsetup.c:5022: warning[objectIndex]: The address of variable 'region_id' might be accessed at non-zero index.
# 5020|   			this_len = (segments) ? segment_len : this_len;
# 5021|   			/* coverity[ptr_arith] intentional */
# 5022|-> 			if (!(r = dm_stats_create_region(dms, &region_ids[count],
# 5023|   							 this_start, this_len, step,
# 5024|   							 precise, bounds,

Error: COMPILER_WARNING:
LVM2.2.03.38/libdm/libdm-stats.c: scope_hint: In function ‘_stats_group_tag_len’
LVM2.2.03.38/libdm/libdm-stats.c:1867:17: warning[-Wunused-but-set-variable=]: variable ‘nr_regions’ set but not used
# 1867 |         int64_t nr_regions = 0;
#      |                 ^~~~~~~~~~
# 1865|   {
# 1866|   	int i, j, next;
# 1867|-> 	int64_t nr_regions = 0;
# 1868|   	size_t buflen = 0, id_len = 0;
# 1869|   

Error: CPPCHECK_WARNING (CWE-457):
LVM2.2.03.38/libdm/libdm-stats.c:2293: error[legacyUninitvar]: Uninitialized variable: lines
# 2291|   	if (dm_snprintf(msg, sizeof(msg), "@stats_print%s " FMTu64 " %s",
# 2292|   			(clear) ? "_clear" : "",
# 2293|-> 			region_id, (start_line || num_lines) ? lines : "") < 0) {
# 2294|   		err = "message";
# 2295|   		goto_bad;

Error: GCC_ANALYZER_WARNING (CWE-457):
LVM2.2.03.38/test/unit/radix_tree_t.c:437:35: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘k[1]’
LVM2.2.03.38/test/unit/radix_tree_t.c:426:13: enter_function: entry to ‘test_iterate_subset’
LVM2.2.03.38/test/unit/radix_tree_t.c:435:21: branch_true: following ‘true’ branch (when ‘i != 100000’)...
LVM2.2.03.38/test/unit/radix_tree_t.c:436:17: branch_true: ...to here
LVM2.2.03.38/test/unit/radix_tree_t.c:436:17: call_function: calling ‘_gen_key’ from ‘test_iterate_subset’
LVM2.2.03.38/test/unit/radix_tree_t.c:436:17: return_function: returning to ‘test_iterate_subset’ from ‘_gen_key’
LVM2.2.03.38/test/unit/radix_tree_t.c:437:20: branch_true: following ‘true’ branch...
LVM2.2.03.38/test/unit/radix_tree_t.c:437:35: branch_true: ...to here
LVM2.2.03.38/test/unit/radix_tree_t.c:437:35: danger: use of uninitialized value ‘k[1]’ here
#  435|   	for (i = 0; i < 100000; i++) {
#  436|           	_gen_key(k, k + sizeof(k));
#  437|->         	if (k[0] == 21 && k[1] == 12)
#  438|                   	subset_count++;
#  439|   		v.n = i;

Error: CPPCHECK_WARNING (CWE-119):
LVM2.2.03.38/tools/command.c:298: error[bufferAccessOutOfBounds]: Buffer is accessed out of bounds: cmd_names[1].name
#  296|   
#  297|   	/* Skip 1st. element for bsearch() */
#  298|-> 	if ((name = bsearch(str, cmd_names[1].name, CMD_COUNT - 1,
#  299|   			    sizeof(cmd_names[0]),
#  300|   			    (int (*)(const void*, const void*))strcmp)))

Error: CPPCHECK_WARNING (CWE-119):
LVM2.2.03.38/tools/command.c:446: error[bufferAccessOutOfBounds]: Buffer is accessed out of bounds: command_names[0].name
#  444|   	}
#  445|   #endif
#  446|-> 	if ((name = bsearch(name, command_names[0].name, LVM_COMMAND_COUNT,
#  447|   			    sizeof(command_names[0]),
#  448|   			    (int (*)(const void*, const void*))strcmp)))

Error: COMPILER_WARNING:
LVM2.2.03.38/tools/lvconvert.c:6043:13: warning[-Wunused-but-set-variable=]: variable ‘lbs_unknown’ set but not used
# 6043 |         int lbs_unknown = 0, lbs_4k = 0, lbs_512 = 0;
#      |             ^~~~~~~~~~~
# 6041|   	uint32_t block_size_setting = 0;
# 6042|   	uint32_t block_size = 0;
# 6043|-> 	int lbs_unknown = 0, lbs_4k = 0, lbs_512 = 0;
# 6044|   	int pbs_unknown = 0, pbs_4k = 0, pbs_512 = 0;
# 6045|   	int rv = 0;

Error: COMPILER_WARNING:
LVM2.2.03.38/tools/lvconvert.c:6044:13: warning[-Wunused-but-set-variable=]: variable ‘pbs_unknown’ set but not used
# 6044 |         int pbs_unknown = 0, pbs_4k = 0, pbs_512 = 0;
#      |             ^~~~~~~~~~~
# 6042|   	uint32_t block_size = 0;
# 6043|   	int lbs_unknown = 0, lbs_4k = 0, lbs_512 = 0;
# 6044|-> 	int pbs_unknown = 0, pbs_4k = 0, pbs_512 = 0;
# 6045|   	int rv = 0;
# 6046|   

Error: COMPILER_WARNING:
LVM2.2.03.38/tools/lvconvert.c: scope_hint: In function ‘_set_writecache_block_size’
LVM2.2.03.38/tools/lvconvert.c:6044:42: warning[-Wunused-but-set-variable=]: variable ‘pbs_512’ set but not used
# 6044 |         int pbs_unknown = 0, pbs_4k = 0, pbs_512 = 0;
#      |                                          ^~~~~~~
# 6042|   	uint32_t block_size = 0;
# 6043|   	int lbs_unknown = 0, lbs_4k = 0, lbs_512 = 0;
# 6044|-> 	int pbs_unknown = 0, pbs_4k = 0, pbs_512 = 0;
# 6045|   	int rv = 0;
# 6046|   

Error: CPPCHECK_WARNING (CWE-457):
LVM2.2.03.38/tools/lvmdevices.c:1036: error[legacyUninitvar]: Uninitialized variable: idname
# 1034|   			goto_bad;
# 1035|   
# 1036|-> 		if (!idtype_str || !idname || !strlen(idname) || !strlen(idtype_str))
# 1037|   			goto_bad;
# 1038|   

Error: CPPCHECK_WARNING (CWE-457):
LVM2.2.03.38/tools/lvmdevices.c:1044: error[legacyUninitvar]: Uninitialized variable: idname
# 1042|   		}
# 1043|   
# 1044|-> 		if (!strncmp(idname, "/dev/", 5))
# 1045|   			log_warn("WARNING: To remove a device by name, use --deldev without --deviceidtype.");
# 1046|   

Error: GCC_ANALYZER_WARNING (CWE-122):
LVM2.2.03.38/tools/pvck.c:2919:13: warning[-Wanalyzer-out-of-bounds]: heap-based buffer over-read
LVM2.2.03.38/tools/pvck.c:3011:12: enter_function: entry to ‘_pvck_mf’
LVM2.2.03.38/tools/pvck.c:3031:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/tools/pvck.c:3050:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/tools/pvck.c:3074:14: branch_false: ...to here
LVM2.2.03.38/tools/pvck.c:3074:14: call_function: calling ‘_get_settings’ from ‘_pvck_mf’
LVM2.2.03.38/tools/pvck.c:3074:14: return_function: returning to ‘_pvck_mf’ from ‘_get_settings’
LVM2.2.03.38/tools/pvck.c:3074:12: branch_false: following ‘false’ branch...
LVM2.2.03.38/tools/pvck.c:3077:13: branch_false: ...to here
LVM2.2.03.38/tools/pvck.c:3077:12: branch_true: following ‘true’ branch...
LVM2.2.03.38/tools/pvck.c:3077:43: branch_true: ...to here
LVM2.2.03.38/tools/pvck.c:3078:20: branch_false: following ‘false’ branch...
LVM2.2.03.38/tools/pvck.c:3081:22: branch_false: ...to here
LVM2.2.03.38/tools/pvck.c:3081:22: call_function: calling ‘_read_metadata_file’ from ‘_pvck_mf’
# 2917|   	if (text_buf[text_size-1] != '\0' ||
# 2918|   	    text_buf[text_size-2] != '\n' ||
# 2919|-> 	    text_buf[text_size-3] != '\n')
# 2920|   		log_warn("WARNING: Unexpected final bytes of raw metadata, expected \\n\\n\\0.");
# 2921|   

Error: GCC_ANALYZER_WARNING (CWE-401):
LVM2.2.03.38/tools/vgcfgbackup.c:50:9: warning[-Wanalyzer-malloc-leak]: leak of ‘_expand_filename(arg_value(cmd, 204), *vg.name,  last_filename)’
LVM2.2.03.38/tools/vgcfgbackup.c:56:12: enter_function: entry to ‘_vg_backup_single’
LVM2.2.03.38/tools/vgcfgbackup.c:63:12: branch_true: following ‘true’ branch...
LVM2.2.03.38/tools/vgcfgbackup.c:64:34: branch_true: ...to here
LVM2.2.03.38/tools/vgcfgbackup.c:64:34: call_function: calling ‘_expand_filename’ from ‘_vg_backup_single’
LVM2.2.03.38/tools/vgcfgbackup.c:64:34: return_function: returning to ‘_vg_backup_single’ from ‘_expand_filename’
LVM2.2.03.38/tools/vgcfgbackup.c:64:20: branch_false: following ‘false’ branch...
LVM2.2.03.38/tools/vgcfgbackup.c:68:47: branch_false: ...to here
LVM2.2.03.38/tools/vgcfgbackup.c:50:9: danger: ‘_expand_filename(arg_value(cmd, 204), *vg.name,  last_filename)’ leaks here; was allocated at [(8)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/7)
#   48|   	}
#   49|   out:
#   50|-> 	free(*last_filename);
#   51|   	*last_filename = filename;
#   52|