Task #112574 - added.err

back to task #112574
download
Error: SHELLCHECK_WARNING (CWE-563):
/usr/bin/lvmpersist:91:2: warning[SC2034]: FINDKEY_DEC appears unused. Verify use (or export if used externally).
#   89|   
#   90|   key_is_on_device_nvme() {
#   91|-> 	FINDKEY_DEC=$(printf '%u' "$FINDKEY")
#   92|   
#   93|   	if nvme resv-report --eds -o json "$dev" 2>/dev/null | grep -q '"rkey":${FINDKEY_DEC}'; then

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.40/daemons/lvmlockd/lvmlockctl.c:870:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(open("/dev/null", 2), fd)’
LVM2.2.03.40/daemons/lvmlockd/lvmlockctl.c:860:12: branch_false: following ‘false’ branch...
LVM2.2.03.40/daemons/lvmlockd/lvmlockctl.c:865:12: branch_false: ...to here
LVM2.2.03.40/daemons/lvmlockd/lvmlockctl.c:865:12: branch_false: following ‘false’ branch...
LVM2.2.03.40/daemons/lvmlockd/lvmlockctl.c:870:13: branch_false: ...to here
LVM2.2.03.40/daemons/lvmlockd/lvmlockctl.c:870:13: acquire_resource: opened here
LVM2.2.03.40/daemons/lvmlockd/lvmlockctl.c:870: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)
#  868|   	}
#  869|   
#  870|-> 	if (dup2(null_fd, fd) == -1) {
#  871|   		log_error("dup2 error %d", errno);
#  872|   		goto out;

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.40/daemons/lvmlockd/lvmlockctl.c:877:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 2)’
LVM2.2.03.40/daemons/lvmlockd/lvmlockctl.c:860:24: acquire_resource: opened here
LVM2.2.03.40/daemons/lvmlockd/lvmlockctl.c:860:12: branch_false: following ‘false’ branch...
LVM2.2.03.40/daemons/lvmlockd/lvmlockctl.c:865:12: branch_false: ...to here
LVM2.2.03.40/daemons/lvmlockd/lvmlockctl.c:865:12: branch_false: following ‘false’ branch...
LVM2.2.03.40/daemons/lvmlockd/lvmlockctl.c:870:13: branch_false: ...to here
LVM2.2.03.40/daemons/lvmlockd/lvmlockctl.c:877:12: danger: ‘open("/dev/null", 2)’ leaks here; was opened at [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#  875|   	r = 1;
#  876|   out:
#  877|-> 	if ((null_fd != fd) && close(null_fd)) {
#  878|   		log_error("close error fd %d %d", null_fd, errno);
#  879|   		return 0;

Error: COMPILER_WARNING:
LVM2.2.03.40/daemons/lvmlockd/lvmlockd-core.c: scope_hint: In function ‘worker_thread_main’
LVM2.2.03.40/daemons/lvmlockd/lvmlockd-core.c:7196:17: warning[-Wstringop-truncation]: ‘strncpy’ output may be truncated copying 64 bytes from a string of length 64
# 7196 |                 strncpy(msg.ls_name, ls_name, sizeof(msg.ls_name) - 1);
#      |                 ^
# 7194|   
# 7195|   	if (act->op == LD_OP_FENCE) {
# 7196|-> 		strncpy(msg.ls_name, ls_name, sizeof(msg.ls_name) - 1);
# 7197|   		msg.ls_name[sizeof(msg.ls_name) - 1] = 0;
# 7198|   		msg.type = HELPER_COMMAND;

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.40/lib/misc/lvm-exec.c:131:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 2)’
LVM2.2.03.40/lib/misc/lvm-exec.c:145:7: enter_function: entry to ‘pipe_open’
LVM2.2.03.40/lib/misc/lvm-exec.c:155:12: branch_false: following ‘false’ branch...
LVM2.2.03.40/lib/misc/lvm-exec.c:160:9: branch_false: ...to here
LVM2.2.03.40/lib/misc/lvm-exec.c:162:12: branch_false: following ‘false’ branch...
LVM2.2.03.40/lib/misc/lvm-exec.c:171:12: branch_false: ...to here
LVM2.2.03.40/lib/misc/lvm-exec.c:171:12: branch_true: following ‘true’ branch...
LVM2.2.03.40/lib/misc/lvm-exec.c:173:22: branch_true: ...to here
LVM2.2.03.40/lib/misc/lvm-exec.c:173:22: call_function: calling ‘_reopen_fd_to_null’ from ‘pipe_open’
#  129|   
#  130|   	if (dup2(null_fd, fd) == -1) {
#  131|-> 		log_sys_error("dup2", "");
#  132|   		goto out;
#  133|   	}

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.40/lib/misc/lvm-exec.c:137:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 2)’
LVM2.2.03.40/lib/misc/lvm-exec.c:120:24: acquire_resource: opened here
LVM2.2.03.40/lib/misc/lvm-exec.c:120:12: branch_false: following ‘false’ branch...
LVM2.2.03.40/lib/misc/lvm-exec.c:125:12: branch_false: ...to here
LVM2.2.03.40/lib/misc/lvm-exec.c:125:12: branch_false: following ‘false’ branch...
LVM2.2.03.40/lib/misc/lvm-exec.c:130:13: branch_false: ...to here
LVM2.2.03.40/lib/misc/lvm-exec.c:137:12: danger: ‘open("/dev/null", 2)’ leaks here; was opened at [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0)
#  135|   	r = 1;
#  136|   out:
#  137|-> 	if ((null_fd != fd) && close(null_fd)) {
#  138|   		log_sys_error("close", "/dev/null");
#  139|   		return 0;

Error: CPPCHECK_WARNING (CWE-476):
LVM2.2.03.40/test/lib/gen_data_blocks.c:251: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pbs
#  249|     char *endTag = strchr(arg, ',');
#  250|     BlockStream *pbs = malloc(sizeof(BlockStream));
#  251|->   memset(pbs, 0, sizeof(BlockStream));
#  252|     pbs->common.claim    = claimBS;
#  253|     pbs->common.generate = generateBS;

Error: CPPCHECK_WARNING (CWE-476):
LVM2.2.03.40/test/lib/gen_data_blocks.c:252: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pbs
#  250|     BlockStream *pbs = malloc(sizeof(BlockStream));
#  251|     memset(pbs, 0, sizeof(BlockStream));
#  252|->   pbs->common.claim    = claimBS;
#  253|     pbs->common.generate = generateBS;
#  254|     pbs->common.report   = reportBS;

Error: CPPCHECK_WARNING (CWE-476):
LVM2.2.03.40/test/lib/gen_data_blocks.c:253: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pbs
#  251|     memset(pbs, 0, sizeof(BlockStream));
#  252|     pbs->common.claim    = claimBS;
#  253|->   pbs->common.generate = generateBS;
#  254|     pbs->common.report   = reportBS;
#  255|     if (endTag != NULL) {

Error: CPPCHECK_WARNING (CWE-476):
LVM2.2.03.40/test/lib/gen_data_blocks.c:254: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pbs
#  252|     pbs->common.claim    = claimBS;
#  253|     pbs->common.generate = generateBS;
#  254|->   pbs->common.report   = reportBS;
#  255|     if (endTag != NULL) {
#  256|       char *endCompress, *endDedupe;

Error: GCC_ANALYZER_WARNING (CWE-476):
LVM2.2.03.40/test/lib/gen_data_blocks.c:258:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pbs’
LVM2.2.03.40/test/lib/gen_data_blocks.c:680:5: enter_function: entry to ‘main’
LVM2.2.03.40/test/lib/gen_data_blocks.c:729:10: branch_true: following ‘true’ branch (when ‘opt != -1’)...
LVM2.2.03.40/test/lib/gen_data_blocks.c:730:5: branch_true: ...to here
LVM2.2.03.40/test/lib/gen_data_blocks.c:738:7: call_function: calling ‘makeBlockStream’ from ‘main’
#  256|       char *endCompress, *endDedupe;
#  257|       dedupe = strtod(&endTag[1], &endDedupe);
#  258|->     pbs->dedupe = rint(DEDUPE_MODULUS * dedupe);
#  259|       switch (*endDedupe) {
#  260|       default:

Error: GCC_ANALYZER_WARNING (CWE-476):
LVM2.2.03.40/test/lib/gen_data_blocks.c:277:8: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pbs’
LVM2.2.03.40/test/lib/gen_data_blocks.c:680:5: enter_function: entry to ‘main’
LVM2.2.03.40/test/lib/gen_data_blocks.c:729:10: branch_true: following ‘true’ branch (when ‘opt != -1’)...
LVM2.2.03.40/test/lib/gen_data_blocks.c:730:5: branch_true: ...to here
LVM2.2.03.40/test/lib/gen_data_blocks.c:738:7: call_function: calling ‘makeBlockStream’ from ‘main’
#  275|     }
#  276|     strncpy(pbs->tag, arg, TAG_SIZE);
#  277|->   if ((pbs->dedupe < 0) || (pbs->dedupe > DEDUPE_MODULUS)) {
#  278|       errx(2, "the dedupe fraction (%f) is invalid", dedupe);
#  279|     }

Error: GCC_ANALYZER_WARNING (CWE-401):
LVM2.2.03.40/test/lib/gen_data_blocks.c:286:10: warning[-Wanalyzer-malloc-leak]: leak of ‘pbs’
LVM2.2.03.40/test/lib/gen_data_blocks.c:680:5: enter_function: entry to ‘main’
LVM2.2.03.40/test/lib/gen_data_blocks.c:729:10: branch_true: following ‘true’ branch (when ‘opt != -1’)...
LVM2.2.03.40/test/lib/gen_data_blocks.c:730:5: branch_true: ...to here
LVM2.2.03.40/test/lib/gen_data_blocks.c:738:7: call_function: calling ‘makeBlockStream’ from ‘main’
#  284|       errx(2, "the compression fraction (%f) is invalid", pbs->compress);
#  285|     }
#  286|->   return &pbs->common;
#  287|   }
#  288|   

Error: CPPCHECK_WARNING (CWE-476):
LVM2.2.03.40/test/lib/gen_data_blocks.c:319: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pzs
#  317|   {
#  318|     DataStream *pzs = malloc(sizeof(DataStream));
#  319|->   memset(pzs, 0, sizeof(DataStream));
#  320|     pzs->claim    = claimZS;
#  321|     pzs->generate = generateZS;

Error: CPPCHECK_WARNING (CWE-476):
LVM2.2.03.40/test/lib/gen_data_blocks.c:320: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pzs
#  318|     DataStream *pzs = malloc(sizeof(DataStream));
#  319|     memset(pzs, 0, sizeof(DataStream));
#  320|->   pzs->claim    = claimZS;
#  321|     pzs->generate = generateZS;
#  322|     pzs->report   = reportZS;

Error: GCC_ANALYZER_WARNING (CWE-476):
LVM2.2.03.40/test/lib/gen_data_blocks.c:320:3: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pzs’
LVM2.2.03.40/test/lib/gen_data_blocks.c:680:5: enter_function: entry to ‘main’
LVM2.2.03.40/test/lib/gen_data_blocks.c:729:10: branch_true: following ‘true’ branch (when ‘opt != -1’)...
LVM2.2.03.40/test/lib/gen_data_blocks.c:730:5: branch_true: ...to here
LVM2.2.03.40/test/lib/gen_data_blocks.c:777:7: call_function: calling ‘makeZeroStream’ from ‘main’
#  318|     DataStream *pzs = malloc(sizeof(DataStream));
#  319|     memset(pzs, 0, sizeof(DataStream));
#  320|->   pzs->claim    = claimZS;
#  321|     pzs->generate = generateZS;
#  322|     pzs->report   = reportZS;

Error: CPPCHECK_WARNING (CWE-476):
LVM2.2.03.40/test/lib/gen_data_blocks.c:321: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pzs
#  319|     memset(pzs, 0, sizeof(DataStream));
#  320|     pzs->claim    = claimZS;
#  321|->   pzs->generate = generateZS;
#  322|     pzs->report   = reportZS;
#  323|     return pzs;

Error: CPPCHECK_WARNING (CWE-476):
LVM2.2.03.40/test/lib/gen_data_blocks.c:322: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pzs
#  320|     pzs->claim    = claimZS;
#  321|     pzs->generate = generateZS;
#  322|->   pzs->report   = reportZS;
#  323|     return pzs;
#  324|   }

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.40/test/unit/daemon_stray_t.c:82:9: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 524288)’
LVM2.2.03.40/test/unit/daemon_stray_t.c:77:19: acquire_resource: opened here
LVM2.2.03.40/test/unit/daemon_stray_t.c:78:9: branch_false: following ‘false’ branch...
LVM2.2.03.40/test/unit/daemon_stray_t.c:81:20: branch_false: ...to here
LVM2.2.03.40/test/unit/daemon_stray_t.c:82:9: danger: ‘open("/dev/null", 524288)’ leaks here; was opened at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#   80|   	/* fd without CLOEXEC - stray, should be closed */
#   81|   	fd_close = open("/dev/null", O_RDONLY);
#   82|-> 	T_ASSERT(fd_close >= 0);
#   83|   	T_ASSERT(fcntl(fd_close, F_SETFD, 0) == 0);
#   84|   

Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.40/test/unit/daemon_stray_t.c:83:9: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 524288)’
LVM2.2.03.40/test/unit/daemon_stray_t.c:77:19: acquire_resource: opened here
LVM2.2.03.40/test/unit/daemon_stray_t.c:78:9: branch_false: following ‘false’ branch...
LVM2.2.03.40/test/unit/daemon_stray_t.c:81:20: branch_false: ...to here
LVM2.2.03.40/test/unit/daemon_stray_t.c:82:9: branch_false: following ‘false’ branch...
LVM2.2.03.40/test/unit/daemon_stray_t.c:83:9: branch_false: ...to here
LVM2.2.03.40/test/unit/daemon_stray_t.c:83:9: danger: ‘open("/dev/null", 524288)’ leaks here; was opened at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#   81|   	fd_close = open("/dev/null", O_RDONLY);
#   82|   	T_ASSERT(fd_close >= 0);
#   83|-> 	T_ASSERT(fcntl(fd_close, F_SETFD, 0) == 0);
#   84|   
#   85|   	daemon_close_stray_fds("test", 1, STDERR_FILENO, &cfds);