Newly introduced findings

List of Findings

Error: SHELLCHECK_WARNING (CWE-563): [#def1]
/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): [#def2]
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): [#def3]
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: [#def4]
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): [#def5]
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): [#def6]
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): [#def7]
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): [#def8]
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): [#def9]
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): [#def10]
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): [#def11]
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): [#def12]
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): [#def13]
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): [#def14]
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): [#def15]
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): [#def16]
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): [#def17]
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): [#def18]
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): [#def19]
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): [#def20]
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);

Scan Properties

analyzer-version-clippy1.95.0
analyzer-version-cppcheck2.20.0
analyzer-version-gcc16.0.1
analyzer-version-gcc-analyzer16.0.1
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.95.0
diffbase-analyzer-version-cppcheck2.20.0
diffbase-analyzer-version-gcc16.0.1
diffbase-analyzer-version-gcc-analyzer16.0.1
diffbase-analyzer-version-shellcheck0.11.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-98.us-west-2.compute.internal
diffbase-known-false-positives/usr/share/csmock/known-false-positives.js
diffbase-known-false-positives-rpmknown-false-positives-0.0.0.20260420.180315.gd39a405.main-1.el9.noarch
diffbase-mock-configfedora-rawhide-x86_64
diffbase-project-namelvm2-2.03.38-2.fc44
diffbase-store-results-to/tmp/tmpfc0tudg6/lvm2-2.03.38-2.fc44.tar.xz
diffbase-time-created2026-04-28 18:07:35
diffbase-time-finished2026-04-28 18:12:22
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'cppcheck,shellcheck,clippy,unicontrol,gcc' '-o' '/tmp/tmpfc0tudg6/lvm2-2.03.38-2.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpfc0tudg6/lvm2-2.03.38-2.fc44.src.rpm'
diffbase-tool-versioncsmock-3.8.5-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-98.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20260420.180315.gd39a405.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-namelvm2-2.03.40-1.fc45
store-results-to/tmp/tmpgfragzaa/lvm2-2.03.40-1.fc45.tar.xz
time-created2026-04-28 18:14:57
time-finished2026-04-28 18:19:11
titleNewly introduced findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'cppcheck,shellcheck,clippy,unicontrol,gcc' '-o' '/tmp/tmpgfragzaa/lvm2-2.03.40-1.fc45.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpgfragzaa/lvm2-2.03.40-1.fc45.src.rpm'
tool-versioncsmock-3.8.5-1.el9