Task #91536 - fixed.err
back to task #91536download
Error: SHELLCHECK_WARNING (CWE-88):
/usr/bin/fsadm:135:2: error[SC2068]: Double quote array expansions to avoid re-splitting elements.
# 133| fi
# 134| verbose "Executing" "$@"
# 135|-> $@
# 136| }
# 137|
Error: SHELLCHECK_WARNING (CWE-88):
/usr/bin/fsadm:140:2: error[SC2068]: Double quote array expansions to avoid re-splitting elements.
# 138| # Accept as success also return code 1 with fsck
# 139| accept_0_1() {
# 140|-> $@
# 141| local ret="$?"
# 142| test "$ret" -eq 1 || return "$ret"
Error: SHELLCHECK_WARNING (CWE-758):
/usr/bin/lvm_import_vdo:33:33: error[SC2218]: This function is only defined later. Move the definition up.
# 31| TOOL=lvm_import_vdo
# 32| IMPORT_NAME="VDO_${TOOL}_${RANDOM}$$"
# 33|-> test ${#IMPORT_NAME} -lt 100 || error "Random name \"$IMPORT_NAME\" is too long!"
# 34| TEMPDIR="${TMPDIR:-/tmp}/$IMPORT_NAME"
# 35|
Error: COMPILER_WARNING (CWE-704):
LVM2.2.03.34/daemons/dmeventd/plugins/vdo/dmeventd_vdo.c: scope_hint: In function ‘register_device’
LVM2.2.03.34/daemons/dmeventd/plugins/vdo/dmeventd_vdo.c:344:27: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 344 | if (!(str = strrchr(state->cmd_str, ' ')))
# | ^
# 342|
# 343| /* Find last space before 'vg/lv' */
# 344|-> if (!(str = strrchr(state->cmd_str, ' ')))
# 345| goto inval;
# 346|
Error: COMPILER_WARNING (CWE-704):
LVM2.2.03.34/daemons/dmeventd/plugins/vdo/dmeventd_vdo.c:344:27: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 342|
# 343| /* Find last space before 'vg/lv' */
# 344|-> if (!(str = strrchr(state->cmd_str, ' ')))
# 345| goto inval;
# 346|
Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.34/daemons/lvmlockd/lvmlockd-sanlock.c:394:59: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&path, "w")’
LVM2.2.03.34/daemons/lvmlockd/lvmlockd-sanlock.c:386:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/daemons/lvmlockd/lvmlockd-sanlock.c:389:20: branch_false: ...to here
LVM2.2.03.34/daemons/lvmlockd/lvmlockd-sanlock.c:389:20: acquire_resource: opened here
LVM2.2.03.34/daemons/lvmlockd/lvmlockd-sanlock.c:389:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/daemons/lvmlockd/lvmlockd-sanlock.c:394:9: branch_false: ...to here
LVM2.2.03.34/daemons/lvmlockd/lvmlockd-sanlock.c:400:13: throw: if ‘fflush’ throws an exception...
LVM2.2.03.34/daemons/lvmlockd/lvmlockd-sanlock.c:394:59: danger: ‘fopen(&path, "w")’ leaks here; was opened at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
# 392| }
# 393|
# 394|-> fprintf(fp, "# vg %s %s created %s", ls->vg_name, ls->vg_uuid, ctime(&t));
# 395| fprintf(fp, "host_id %u\n", ls->host_id);
# 396| fprintf(fp, "generation %llu\n", (unsigned long long)ls->generation);
Error: GCC_ANALYZER_WARNING (CWE-401):
LVM2.2.03.34/daemons/lvmlockd/lvmlockd-sanlock.c:394:59: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&path, "w")’
LVM2.2.03.34/daemons/lvmlockd/lvmlockd-sanlock.c:386:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/daemons/lvmlockd/lvmlockd-sanlock.c:389:20: branch_false: ...to here
LVM2.2.03.34/daemons/lvmlockd/lvmlockd-sanlock.c:389:20: acquire_memory: allocated here
LVM2.2.03.34/daemons/lvmlockd/lvmlockd-sanlock.c:389:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/daemons/lvmlockd/lvmlockd-sanlock.c:394:9: branch_false: ...to here
LVM2.2.03.34/daemons/lvmlockd/lvmlockd-sanlock.c:400:13: throw: if ‘fflush’ throws an exception...
LVM2.2.03.34/daemons/lvmlockd/lvmlockd-sanlock.c:394:59: danger: ‘fopen(&path, "w")’ leaks here; was allocated at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
# 392| }
# 393|
# 394|-> fprintf(fp, "# vg %s %s created %s", ls->vg_name, ls->vg_uuid, ctime(&t));
# 395| fprintf(fp, "host_id %u\n", ls->host_id);
# 396| fprintf(fp, "generation %llu\n", (unsigned long long)ls->generation);
Error: COMPILER_WARNING (CWE-704):
LVM2.2.03.34/device_mapper/libdm-common.c: scope_hint: In function ‘dm_task_set_name’
LVM2.2.03.34/device_mapper/libdm-common.c:674:18: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 674 | if ((pos = strrchr(name, '/')))
# | ^
# 672|
# 673| /* Path supplied for existing device? */
# 674|-> if ((pos = strrchr(name, '/')))
# 675| return _dm_task_set_name_from_path(dmt, name, pos + 1);
# 676|
Error: COMPILER_WARNING (CWE-704):
LVM2.2.03.34/device_mapper/libdm-common.c:674:18: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 672|
# 673| /* Path supplied for existing device? */
# 674|-> if ((pos = strrchr(name, '/')))
# 675| return _dm_task_set_name_from_path(dmt, name, pos + 1);
# 676|
Error: COMPILER_WARNING (CWE-704):
LVM2.2.03.34/device_mapper/libdm-common.c: scope_hint: In function ‘_mountinfo_parse_line’
LVM2.2.03.34/device_mapper/libdm-common.c:1769:37: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1769 | if (*maj == 0 && (devmapper = strstr(line, "/dev/mapper/"))) {
# | ^
# 1767| /* btrfs fakes device numbers, but there is still /dev/mapper name
# 1768| * placed in mountinfo, so try to detect proper major:minor via this */
# 1769|-> if (*maj == 0 && (devmapper = strstr(line, "/dev/mapper/"))) {
# 1770| if (!(dmt = dm_task_create(DM_DEVICE_INFO))) {
# 1771| log_error("Mount info task creation failed.");
Error: COMPILER_WARNING (CWE-704):
LVM2.2.03.34/device_mapper/libdm-common.c:1769:37: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1767| /* btrfs fakes device numbers, but there is still /dev/mapper name
# 1768| * placed in mountinfo, so try to detect proper major:minor via this */
# 1769|-> if (*maj == 0 && (devmapper = strstr(line, "/dev/mapper/"))) {
# 1770| if (!(dmt = dm_task_create(DM_DEVICE_INFO))) {
# 1771| log_error("Mount info task creation failed.");
Error: GCC_ANALYZER_WARNING (CWE-401):
LVM2.2.03.34/lib/activate/dev_manager.c:2443:26: warning[-Wanalyzer-malloc-leak]: leak of ‘opendir(&sysfs_path)’
LVM2.2.03.34/lib/activate/dev_manager.c:3980:12: enter_function: entry to ‘_tree_action’
LVM2.2.03.34/lib/activate/dev_manager.c:4013:17: call_function: calling ‘_create_partial_dtree’ from ‘_tree_action’
# 2441| }
# 2442|
# 2443|-> while ((dirent = readdir(d)))
# 2444| /* Expects minor is added to 'dm-' prefix */
# 2445| if (!strncmp(dirent->d_name, "dm-", 3) &&
Error: GCC_ANALYZER_WARNING (CWE-401):
LVM2.2.03.34/lib/commands/toolcontext.c:1653:9: warning[-Wanalyzer-malloc-leak]: leak of ‘calloc(1, 18440)’
LVM2.2.03.34/lib/commands/toolcontext.c:1629:21: enter_function: entry to ‘create_toolcontext’
LVM2.2.03.34/lib/commands/toolcontext.c:1649:21: call_function: inlined call to ‘zalloc’ from ‘create_toolcontext’
LVM2.2.03.34/lib/commands/toolcontext.c:1649:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/commands/toolcontext.c:1653:9: branch_false: ...to here
LVM2.2.03.34/lib/commands/toolcontext.c:1662:9: throw: if ‘dm_list_init’ throws an exception...
LVM2.2.03.34/lib/commands/toolcontext.c:1653:9: danger: ‘calloc(1, 18440)’ leaks here; was allocated at [(3)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/2)
# 1651| return NULL;
# 1652| }
# 1653|-> cmd->is_long_lived = is_clvmd;
# 1654| cmd->is_clvmd = is_clvmd;
# 1655| cmd->threaded = threaded ? 1 : 0;
Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.34/lib/device/device_id.c:1195:9: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&*cmd.devices_file_path, "r")’
LVM2.2.03.34/lib/device/device_id.c:1211:5: enter_function: entry to ‘device_ids_read’
LVM2.2.03.34/lib/device/device_id.c:1238:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/device_id.c:1244:9: branch_false: ...to here
LVM2.2.03.34/lib/device/device_id.c:1246:20: acquire_resource: opened here
LVM2.2.03.34/lib/device/device_id.c:1246:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/device_id.c:1246:12: branch_false: ...to here
LVM2.2.03.34/lib/device/device_id.c:1251:16: branch_true: following ‘true’ branch...
LVM2.2.03.34/lib/device/device_id.c:1254:22: branch_true: ...to here
LVM2.2.03.34/lib/device/device_id.c:1259:20: branch_true: following ‘true’ branch...
LVM2.2.03.34/lib/device/device_id.c:1260:25: branch_true: ...to here
LVM2.2.03.34/lib/device/device_id.c:1260:25: call_function: calling ‘_copy_idline_str’ from ‘device_ids_read’
LVM2.2.03.34/lib/device/device_id.c:1260:25: return_function: returning to ‘device_ids_read’ from ‘_copy_idline_str’
LVM2.2.03.34/lib/device/device_id.c:1263:28: branch_true: following ‘true’ branch...
LVM2.2.03.34/lib/device/device_id.c:1264:33: branch_true: ...to here
LVM2.2.03.34/lib/device/device_id.c:1264:33: throw: if ‘print_log’ throws an exception...
LVM2.2.03.34/lib/device/device_id.c:1195:9: danger: ‘fopen(&*cmd.devices_file_path, "r")’ leaks here; was opened at [(4)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/3)
# 1193| char *s, *d = dst;
# 1194|
# 1195|-> memset(dst, 0, len);
# 1196|
# 1197| if (!(s = strchr(src, '=')))
Error: GCC_ANALYZER_WARNING (CWE-401):
LVM2.2.03.34/lib/device/device_id.c:1195:9: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&*cmd.devices_file_path, "r")’
LVM2.2.03.34/lib/device/device_id.c:1211:5: enter_function: entry to ‘device_ids_read’
LVM2.2.03.34/lib/device/device_id.c:1238:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/device_id.c:1244:9: branch_false: ...to here
LVM2.2.03.34/lib/device/device_id.c:1246:20: acquire_memory: allocated here
LVM2.2.03.34/lib/device/device_id.c:1246:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/device_id.c:1246:12: branch_false: ...to here
LVM2.2.03.34/lib/device/device_id.c:1251:16: branch_true: following ‘true’ branch...
LVM2.2.03.34/lib/device/device_id.c:1254:22: branch_true: ...to here
LVM2.2.03.34/lib/device/device_id.c:1259:20: branch_true: following ‘true’ branch...
LVM2.2.03.34/lib/device/device_id.c:1260:25: branch_true: ...to here
LVM2.2.03.34/lib/device/device_id.c:1260:25: call_function: calling ‘_copy_idline_str’ from ‘device_ids_read’
LVM2.2.03.34/lib/device/device_id.c:1260:25: return_function: returning to ‘device_ids_read’ from ‘_copy_idline_str’
LVM2.2.03.34/lib/device/device_id.c:1263:28: branch_true: following ‘true’ branch...
LVM2.2.03.34/lib/device/device_id.c:1264:33: branch_true: ...to here
LVM2.2.03.34/lib/device/device_id.c:1264:33: throw: if ‘print_log’ throws an exception...
LVM2.2.03.34/lib/device/device_id.c:1195:9: danger: ‘fopen(&*cmd.devices_file_path, "r")’ leaks here; was allocated at [(4)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/3)
# 1193| char *s, *d = dst;
# 1194|
# 1195|-> memset(dst, 0, len);
# 1196|
# 1197| if (!(s = strchr(src, '=')))
Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.34/lib/device/device_id.c:1270:21: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&*cmd.devices_file_path, "r")’
LVM2.2.03.34/lib/device/device_id.c:1238:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/device_id.c:1244:9: branch_false: ...to here
LVM2.2.03.34/lib/device/device_id.c:1246:20: acquire_resource: opened here
LVM2.2.03.34/lib/device/device_id.c:1246:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/device_id.c:1246:12: branch_false: ...to here
LVM2.2.03.34/lib/device/device_id.c:1251:16: branch_true: following ‘true’ branch...
LVM2.2.03.34/lib/device/device_id.c:1254:22: branch_true: ...to here
LVM2.2.03.34/lib/device/device_id.c:1259:20: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/device_id.c:1270:21: branch_false: ...to here
LVM2.2.03.34/lib/device/device_id.c:1270:20: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/device_id.c:1274:22: branch_false: ...to here
LVM2.2.03.34/lib/device/device_id.c:1274:20: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/device_id.c:1277:56: branch_false: ...to here
LVM2.2.03.34/lib/device/device_id.c:1277:24: throw: if ‘calc_crc’ throws an exception...
LVM2.2.03.34/lib/device/device_id.c:1270:21: danger: ‘fopen(&*cmd.devices_file_path, "r")’ leaks here; was opened at [(3)](sarif:/runs/0/results/18/codeFlows/0/threadFlows/0/locations/2)
# 1268| }
# 1269|
# 1270|-> if (line[0] == '#')
# 1271| continue;
# 1272|
Error: GCC_ANALYZER_WARNING (CWE-401):
LVM2.2.03.34/lib/device/device_id.c:1270:21: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&*cmd.devices_file_path, "r")’
LVM2.2.03.34/lib/device/device_id.c:1238:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/device_id.c:1244:9: branch_false: ...to here
LVM2.2.03.34/lib/device/device_id.c:1246:20: acquire_memory: allocated here
LVM2.2.03.34/lib/device/device_id.c:1246:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/device_id.c:1246:12: branch_false: ...to here
LVM2.2.03.34/lib/device/device_id.c:1251:16: branch_true: following ‘true’ branch...
LVM2.2.03.34/lib/device/device_id.c:1254:22: branch_true: ...to here
LVM2.2.03.34/lib/device/device_id.c:1259:20: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/device_id.c:1270:21: branch_false: ...to here
LVM2.2.03.34/lib/device/device_id.c:1270:20: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/device_id.c:1274:22: branch_false: ...to here
LVM2.2.03.34/lib/device/device_id.c:1274:20: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/device_id.c:1277:56: branch_false: ...to here
LVM2.2.03.34/lib/device/device_id.c:1277:24: throw: if ‘calc_crc’ throws an exception...
LVM2.2.03.34/lib/device/device_id.c:1270:21: danger: ‘fopen(&*cmd.devices_file_path, "r")’ leaks here; was allocated at [(3)](sarif:/runs/0/results/19/codeFlows/0/threadFlows/0/locations/2)
# 1268| }
# 1269|
# 1270|-> if (line[0] == '#')
# 1271| continue;
# 1272|
Error: GCC_ANALYZER_WARNING (CWE-401):
LVM2.2.03.34/lib/device/device_id.c:2577:45: warning[-Wanalyzer-malloc-leak]: leak of ‘calloc(1, 32)’
LVM2.2.03.34/lib/device/device_id.c:2517:12: enter_function: entry to ‘_match_du_to_dev’
LVM2.2.03.34/lib/device/device_id.c:2554:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/device_id.c:2561:21: branch_false: ...to here
LVM2.2.03.34/lib/device/device_id.c:2561:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/device_id.c:2569:13: branch_false: ...to here
LVM2.2.03.34/lib/device/device_id.c:2569:12: branch_true: following ‘true’ branch...
LVM2.2.03.34/lib/device/device_id.c:2570:30: branch_true: ...to here
LVM2.2.03.34/lib/device/device_id.c:2574:36: call_function: inlined call to ‘zalloc’ from ‘_match_du_to_dev’
LVM2.2.03.34/lib/device/device_id.c:2574:28: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/device_id.c:2576:25: branch_false: ...to here
LVM2.2.03.34/lib/device/device_id.c:2578:25: throw: if ‘dm_list_add’ throws an exception...
LVM2.2.03.34/lib/device/device_id.c:2577:45: danger: ‘calloc(1, 32)’ leaks here; was allocated at [(9)](sarif:/runs/0/results/36/codeFlows/0/threadFlows/0/locations/8)
# 2575| return_0;
# 2576| id->idtype = DEV_ID_TYPE_DEVNAME;
# 2577|-> id->idname = strdup(du->idname);
# 2578| dm_list_add(&dev->ids, &id->list);
# 2579| du->dev = dev;
Error: GCC_ANALYZER_WARNING (CWE-401):
LVM2.2.03.34/lib/device/device_id.c:2578:25: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
LVM2.2.03.34/lib/device/device_id.c:2554:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/device_id.c:2561:21: branch_false: ...to here
LVM2.2.03.34/lib/device/device_id.c:2561:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/device_id.c:2569:13: branch_false: ...to here
LVM2.2.03.34/lib/device/device_id.c:2569:12: branch_true: following ‘true’ branch...
LVM2.2.03.34/lib/device/device_id.c:2570:30: branch_true: ...to here
LVM2.2.03.34/lib/device/device_id.c:2574:28: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/device_id.c:2576:25: branch_false: ...to here
LVM2.2.03.34/lib/device/device_id.c:2577:38: acquire_memory: allocated here
LVM2.2.03.34/lib/device/device_id.c:2578:25: throw: if ‘dm_list_add’ throws an exception...
LVM2.2.03.34/lib/device/device_id.c:2578:25: danger: ‘<unknown>’ leaks here; was allocated at [(9)](sarif:/runs/0/results/37/codeFlows/0/threadFlows/0/locations/8)
# 2576| id->idtype = DEV_ID_TYPE_DEVNAME;
# 2577| id->idname = strdup(du->idname);
# 2578|-> dm_list_add(&dev->ids, &id->list);
# 2579| du->dev = dev;
# 2580| dev->id = id;
Error: GCC_ANALYZER_WARNING (CWE-688):
LVM2.2.03.34/lib/device/filesystem.c:191:22: warning[-Wanalyzer-null-argument]: use of NULL ‘opendir(&devices_path)’ where non-null expected
LVM2.2.03.34/lib/device/filesystem.c:172:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/filesystem.c:179:20: branch_false: ...to here
LVM2.2.03.34/lib/device/filesystem.c:179:20: acquire_memory: allocated here
LVM2.2.03.34/lib/device/filesystem.c:179:12: release_memory: assuming ‘opendir(&devices_path)’ is NULL
LVM2.2.03.34/lib/device/filesystem.c:179:12: branch_true: following ‘true’ branch...
LVM2.2.03.34/lib/device/filesystem.c:180:21: branch_true: ...to here
LVM2.2.03.34/lib/device/filesystem.c:180:20: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/filesystem.c:180:20: branch_false: ...to here
LVM2.2.03.34/lib/device/filesystem.c:191:22: danger: argument 1 (‘opendir(&devices_path)’) NULL where non-null expected
# 189| * So also call _fs_get_mnt for every devices to find a matched mount point.
# 190| */
# 191|-> while ((de = readdir(dr))) {
# 192| if (!strcmp(de->d_name, ".") || !strcmp(de->d_name, ".."))
# 193| continue;
Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.34/lib/device/persist.c:241:13: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&path, "w")’
LVM2.2.03.34/lib/device/persist.c:231:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/persist.c:234:20: branch_false: ...to here
LVM2.2.03.34/lib/device/persist.c:234:20: acquire_resource: opened here
LVM2.2.03.34/lib/device/persist.c:234:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/persist.c:239:9: branch_false: ...to here
LVM2.2.03.34/lib/device/persist.c:241:13: throw: if ‘fflush’ throws an exception...
LVM2.2.03.34/lib/device/persist.c:241:13: danger: ‘fopen(&path, "w")’ leaks here; was opened at [(3)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/2)
# 239| fprintf(fp, "0x%llx\n", (unsigned long long)key);
# 240|
# 241|-> if (fflush(fp))
# 242| log_debug("Failed to write/flush key file");
# 243| if (fclose(fp))
Error: GCC_ANALYZER_WARNING (CWE-401):
LVM2.2.03.34/lib/device/persist.c:241:13: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&path, "w")’
LVM2.2.03.34/lib/device/persist.c:231:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/persist.c:234:20: branch_false: ...to here
LVM2.2.03.34/lib/device/persist.c:234:20: acquire_memory: allocated here
LVM2.2.03.34/lib/device/persist.c:234:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/persist.c:239:9: branch_false: ...to here
LVM2.2.03.34/lib/device/persist.c:241:13: throw: if ‘fflush’ throws an exception...
LVM2.2.03.34/lib/device/persist.c:241:13: danger: ‘fopen(&path, "w")’ leaks here; was allocated at [(3)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/2)
# 239| fprintf(fp, "0x%llx\n", (unsigned long long)key);
# 240|
# 241|-> if (fflush(fp))
# 242| log_debug("Failed to write/flush key file");
# 243| if (fclose(fp))
Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.34/lib/device/persist.c:242:17: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&path, "w")’
LVM2.2.03.34/lib/device/persist.c:231:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/persist.c:234:20: branch_false: ...to here
LVM2.2.03.34/lib/device/persist.c:234:20: acquire_resource: opened here
LVM2.2.03.34/lib/device/persist.c:234:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/persist.c:239:9: branch_false: ...to here
LVM2.2.03.34/lib/device/persist.c:241:12: branch_true: following ‘true’ branch...
LVM2.2.03.34/lib/device/persist.c:242:17: branch_true: ...to here
LVM2.2.03.34/lib/device/persist.c:242:17: throw: if ‘print_log’ throws an exception...
LVM2.2.03.34/lib/device/persist.c:242:17: danger: ‘fopen(&path, "w")’ leaks here; was opened at [(3)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/2)
# 240|
# 241| if (fflush(fp))
# 242|-> log_debug("Failed to write/flush key file");
# 243| if (fclose(fp))
# 244| log_debug("Failed to write/close key file");
Error: GCC_ANALYZER_WARNING (CWE-401):
LVM2.2.03.34/lib/device/persist.c:242:17: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&path, "w")’
LVM2.2.03.34/lib/device/persist.c:231:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/persist.c:234:20: branch_false: ...to here
LVM2.2.03.34/lib/device/persist.c:234:20: acquire_memory: allocated here
LVM2.2.03.34/lib/device/persist.c:234:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/lib/device/persist.c:239:9: branch_false: ...to here
LVM2.2.03.34/lib/device/persist.c:241:12: branch_true: following ‘true’ branch...
LVM2.2.03.34/lib/device/persist.c:242:17: branch_true: ...to here
LVM2.2.03.34/lib/device/persist.c:242:17: throw: if ‘print_log’ throws an exception...
LVM2.2.03.34/lib/device/persist.c:242:17: danger: ‘fopen(&path, "w")’ leaks here; was allocated at [(3)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/2)
# 240|
# 241| if (fflush(fp))
# 242|-> log_debug("Failed to write/flush key file");
# 243| if (fclose(fp))
# 244| log_debug("Failed to write/close key file");
Error: COMPILER_WARNING (CWE-704):
LVM2.2.03.34/lib/format_text/format-text.c: scope_hint: In function ‘_vg_write_file’
LVM2.2.03.34/lib/format_text/format-text.c:1303:15: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1303 | slash = strrchr(tc->path_edit, '/');
# | ^
# 1301| char temp_file[PATH_MAX], temp_dir[PATH_MAX];
# 1302|
# 1303|-> slash = strrchr(tc->path_edit, '/');
# 1304|
# 1305| if (slash == 0)
Error: COMPILER_WARNING (CWE-704):
LVM2.2.03.34/lib/format_text/format-text.c:1303:15: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1301| char temp_file[PATH_MAX], temp_dir[PATH_MAX];
# 1302|
# 1303|-> slash = strrchr(tc->path_edit, '/');
# 1304|
# 1305| if (slash == 0)
Error: COMPILER_WARNING (CWE-704):
LVM2.2.03.34/lib/format_text/format-text.c: scope_hint: In function ‘_create_text_context’
LVM2.2.03.34/lib/format_text/format-text.c:2089:18: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 2089 | if ((tmp = strstr(path, ".tmp")) && (tmp == path + strlen(path) - 4)) {
# | ^
# 2087| path = tc->path_live;
# 2088|
# 2089|-> if ((tmp = strstr(path, ".tmp")) && (tmp == path + strlen(path) - 4)) {
# 2090| log_error("%s: Volume group filename may not end in .tmp",
# 2091| path);
Error: COMPILER_WARNING (CWE-704):
LVM2.2.03.34/lib/format_text/format-text.c:2089:18: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 2087| path = tc->path_live;
# 2088|
# 2089|-> if ((tmp = strstr(path, ".tmp")) && (tmp == path + strlen(path) - 4)) {
# 2090| log_error("%s: Volume group filename may not end in .tmp",
# 2091| path);
Error: COMPILER_WARNING (CWE-704):
LVM2.2.03.34/lib/metadata/raid_manip.c: scope_hint: In function ‘_drop_suffix’
LVM2.2.03.34/lib/metadata/raid_manip.c:175:17: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 175 | if (!(p = strstr(str, suffix)))
# | ^
# 173| char *p;
# 174|
# 175|-> if (!(p = strstr(str, suffix)))
# 176| return_0;
# 177|
Error: COMPILER_WARNING (CWE-704):
LVM2.2.03.34/lib/metadata/raid_manip.c:175:17: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 173| char *p;
# 174|
# 175|-> if (!(p = strstr(str, suffix)))
# 176| return_0;
# 177|
Error: COMPILER_WARNING (CWE-704):
LVM2.2.03.34/lib/misc/lvm-string.c: scope_hint: In function ‘first_substring’
LVM2.2.03.34/lib/misc/lvm-string.c:295:24: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 295 | if ((r = strstr(str, substr)))
# | ^
# 293|
# 294| while ((substr = va_arg(ap, char *)))
# 295|-> if ((r = strstr(str, substr)))
# 296| break;
# 297|
Error: COMPILER_WARNING (CWE-704):
LVM2.2.03.34/lib/misc/lvm-string.c:295:24: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 293|
# 294| while ((substr = va_arg(ap, char *)))
# 295|-> if ((r = strstr(str, substr)))
# 296| break;
# 297|
Error: GCC_ANALYZER_WARNING (CWE-401):
LVM2.2.03.34/lib/raid/raid.c:681:25: warning[-Wanalyzer-malloc-leak]: leak of ‘_init_raid_segtype(cmd, & _raid_types[i], get_monitor_dso_path(cmd, 284), monitored)’
LVM2.2.03.34/lib/raid/raid.c:699:5: enter_function: entry to ‘init_raid_segtypes’
LVM2.2.03.34/lib/raid/raid.c:721:21: branch_true: following ‘true’ branch (when ‘i != 21’)...
LVM2.2.03.34/lib/raid/raid.c:722:32: branch_true: ...to here
LVM2.2.03.34/lib/raid/raid.c:722:32: call_function: calling ‘_init_raid_segtype’ from ‘init_raid_segtypes’
LVM2.2.03.34/lib/raid/raid.c:722:32: return_function: returning to ‘init_raid_segtypes’ from ‘_init_raid_segtype’
LVM2.2.03.34/lib/raid/raid.c:722:20: branch_true: following ‘true’ branch...
LVM2.2.03.34/lib/raid/raid.c:723:22: branch_true: ...to here
LVM2.2.03.34/lib/raid/raid.c:681:25: danger: ‘_init_raid_segtype(cmd, & _raid_types[i], get_monitor_dso_path(cmd, 284), monitored)’ leaks here; was allocated at [(7)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/6)
# 679|
# 680| segtype->ops = &_raid_ops;
# 681|-> segtype->name = rt->name;
# 682| segtype->flags = SEG_RAID | SEG_ONLY_EXCLUSIVE | rt->extra_flags;
# 683|
Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.34/libdaemon/server/daemon-server.c:344:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 2)’
LVM2.2.03.34/libdaemon/server/daemon-server.c:338:19: acquire_resource: opened here
LVM2.2.03.34/libdaemon/server/daemon-server.c:338:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:343:9: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:344:12: danger: ‘open("/dev/null", 2)’ leaks here; was opened at [(1)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/0)
# 342|
# 343| sigemptyset(&my_sigset);
# 344|-> if (sigprocmask(SIG_SETMASK, &my_sigset, NULL) < 0) {
# 345| fprintf(stderr, "Unable to restore signals.\n");
# 346| exit(EXIT_FAILURE);
Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.34/libdaemon/server/daemon-server.c:350:9: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 2)’
LVM2.2.03.34/libdaemon/server/daemon-server.c:338:19: acquire_resource: opened here
LVM2.2.03.34/libdaemon/server/daemon-server.c:338:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:343:9: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:344:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:348:9: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:350:9: danger: ‘open("/dev/null", 2)’ leaks here; was opened at [(1)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/0)
# 348| signal(SIGTERM, &_exit_handler);
# 349|
# 350|-> switch (pid = fork()) {
# 351| case -1:
# 352| perror("fork failed:");
Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.34/libdaemon/server/daemon-server.c:381:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 2)’
LVM2.2.03.34/libdaemon/server/daemon-server.c:338:19: acquire_resource: opened here
LVM2.2.03.34/libdaemon/server/daemon-server.c:338:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:343:9: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:344:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:348:9: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:381:12: danger: ‘open("/dev/null", 2)’ leaks here; was opened at [(1)](sarif:/runs/0/results/11/codeFlows/0/threadFlows/0/locations/0)
# 379| }
# 380|
# 381|-> if (chdir("/")) {
# 382| perror("Cannot chdir to /");
# 383| exit(1);
Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(open("/dev/null", 2), 0)’
LVM2.2.03.34/libdaemon/server/daemon-server.c:338:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:343:9: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:344:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:348:9: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:381:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:14: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:14: acquire_resource: opened here
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:12: danger: ‘dup2(open("/dev/null", 2), 0)’ leaks here; was opened at [(9)](sarif:/runs/0/results/13/codeFlows/0/threadFlows/0/locations/8)
# 384| }
# 385|
# 386|-> if ((dup2(fd, STDIN_FILENO) == -1) ||
# 387| (dup2(fd, STDOUT_FILENO) == -1) ||
# 388| (dup2(fd, STDERR_FILENO) == -1)) {
Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 2)’
LVM2.2.03.34/libdaemon/server/daemon-server.c:338:19: acquire_resource: opened here
LVM2.2.03.34/libdaemon/server/daemon-server.c:338:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:343:9: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:344:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:348:9: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:381:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:14: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:12: danger: ‘open("/dev/null", 2)’ leaks here; was opened at [(1)](sarif:/runs/0/results/12/codeFlows/0/threadFlows/0/locations/0)
# 384| }
# 385|
# 386|-> if ((dup2(fd, STDIN_FILENO) == -1) ||
# 387| (dup2(fd, STDOUT_FILENO) == -1) ||
# 388| (dup2(fd, STDERR_FILENO) == -1)) {
Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:13: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(open("/dev/null", 2), 1)’
LVM2.2.03.34/libdaemon/server/daemon-server.c:338:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:343:9: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:344:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:348:9: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:381:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:14: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:387:14: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:387:14: acquire_resource: opened here
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:13: danger: ‘dup2(open("/dev/null", 2), 1)’ leaks here; was opened at [(11)](sarif:/runs/0/results/15/codeFlows/0/threadFlows/0/locations/10)
# 384| }
# 385|
# 386|-> if ((dup2(fd, STDIN_FILENO) == -1) ||
# 387| (dup2(fd, STDOUT_FILENO) == -1) ||
# 388| (dup2(fd, STDERR_FILENO) == -1)) {
Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:13: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(open("/dev/null", 2), 2)’
LVM2.2.03.34/libdaemon/server/daemon-server.c:338:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:343:9: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:344:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:348:9: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:381:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:14: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:387:14: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:13: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:388:14: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:388:14: acquire_resource: opened here
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:13: danger: ‘dup2(open("/dev/null", 2), 2)’ leaks here; was opened at [(13)](sarif:/runs/0/results/17/codeFlows/0/threadFlows/0/locations/12)
# 384| }
# 385|
# 386|-> if ((dup2(fd, STDIN_FILENO) == -1) ||
# 387| (dup2(fd, STDOUT_FILENO) == -1) ||
# 388| (dup2(fd, STDERR_FILENO) == -1)) {
Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:13: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 2)’
LVM2.2.03.34/libdaemon/server/daemon-server.c:338:19: acquire_resource: opened here
LVM2.2.03.34/libdaemon/server/daemon-server.c:338:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:343:9: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:344:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:348:9: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:381:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:14: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:387:14: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:13: danger: ‘open("/dev/null", 2)’ leaks here; was opened at [(1)](sarif:/runs/0/results/14/codeFlows/0/threadFlows/0/locations/0)
# 384| }
# 385|
# 386|-> if ((dup2(fd, STDIN_FILENO) == -1) ||
# 387| (dup2(fd, STDOUT_FILENO) == -1) ||
# 388| (dup2(fd, STDERR_FILENO) == -1)) {
Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:13: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 2)’
LVM2.2.03.34/libdaemon/server/daemon-server.c:338:19: acquire_resource: opened here
LVM2.2.03.34/libdaemon/server/daemon-server.c:338:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:343:9: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:344:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:348:9: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:381:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:14: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:387:14: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:13: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdaemon/server/daemon-server.c:388:14: branch_false: ...to here
LVM2.2.03.34/libdaemon/server/daemon-server.c:386:13: danger: ‘open("/dev/null", 2)’ leaks here; was opened at [(1)](sarif:/runs/0/results/16/codeFlows/0/threadFlows/0/locations/0)
# 384| }
# 385|
# 386|-> if ((dup2(fd, STDIN_FILENO) == -1) ||
# 387| (dup2(fd, STDOUT_FILENO) == -1) ||
# 388| (dup2(fd, STDERR_FILENO) == -1)) {
Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:661:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(open("/dev/null", 2), 0)’
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:634:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:639:20: branch_false: ...to here
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:639:12: branch_false: following ‘false’ branch (when ‘pid >= 0’)...
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:644:12: branch_false: ...to here
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:644:12: branch_false: following ‘false’ branch (when ‘pid == 0’)...
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:650:13: branch_false: ...to here
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:650:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:655:13: branch_false: ...to here
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:655:12: branch_true: following ‘true’ branch...
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:656:27: branch_true: ...to here
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:656:20: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:661:22: branch_false: ...to here
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:661:22: acquire_resource: opened here
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:661:20: danger: ‘dup2(open("/dev/null", 2), 0)’ leaks here; was opened at [(13)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/12)
# 659| }
# 660|
# 661|-> if ((dup2(fd, STDIN_FILENO) == -1) ||
# 662| (dup2(fd, STDOUT_FILENO) == -1) ||
# 663| (dup2(fd, STDERR_FILENO) == -1)) {
Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:661:21: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(open("/dev/null", 2), 1)’
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:634:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:639:20: branch_false: ...to here
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:639:12: branch_false: following ‘false’ branch (when ‘pid >= 0’)...
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:644:12: branch_false: ...to here
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:644:12: branch_false: following ‘false’ branch (when ‘pid == 0’)...
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:650:13: branch_false: ...to here
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:650:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:655:13: branch_false: ...to here
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:655:12: branch_true: following ‘true’ branch...
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:656:27: branch_true: ...to here
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:656:20: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:661:22: branch_false: ...to here
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:661:20: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:662:22: branch_false: ...to here
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:662:22: acquire_resource: opened here
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:661:21: danger: ‘dup2(open("/dev/null", 2), 1)’ leaks here; was opened at [(15)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/14)
# 659| }
# 660|
# 661|-> if ((dup2(fd, STDIN_FILENO) == -1) ||
# 662| (dup2(fd, STDOUT_FILENO) == -1) ||
# 663| (dup2(fd, STDERR_FILENO) == -1)) {
Error: GCC_ANALYZER_WARNING (CWE-775):
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:661:21: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(open("/dev/null", 2), 2)’
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:634:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:639:20: branch_false: ...to here
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:639:12: branch_false: following ‘false’ branch (when ‘pid >= 0’)...
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:644:12: branch_false: ...to here
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:644:12: branch_false: following ‘false’ branch (when ‘pid == 0’)...
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:650:13: branch_false: ...to here
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:650:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:655:13: branch_false: ...to here
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:655:12: branch_true: following ‘true’ branch...
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:656:27: branch_true: ...to here
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:656:20: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:661:22: branch_false: ...to here
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:661:20: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:662:22: branch_false: ...to here
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:661:21: branch_false: following ‘false’ branch...
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:663:22: branch_false: ...to here
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:663:22: acquire_resource: opened here
LVM2.2.03.34/libdm/dm-tools/dmfilemapd.c:661:21: danger: ‘dup2(open("/dev/null", 2), 2)’ leaks here; was opened at [(17)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/16)
# 659| }
# 660|
# 661|-> if ((dup2(fd, STDIN_FILENO) == -1) ||
# 662| (dup2(fd, STDOUT_FILENO) == -1) ||
# 663| (dup2(fd, STDERR_FILENO) == -1)) {
Error: COMPILER_WARNING (CWE-704):
LVM2.2.03.34/libdm/libdm-common.c: scope_hint: In function ‘dm_task_set_name’
LVM2.2.03.34/libdm/libdm-common.c:672:18: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 672 | if ((pos = strrchr(name, '/')))
# | ^
# 670|
# 671| /* Path supplied for existing device? */
# 672|-> if ((pos = strrchr(name, '/')))
# 673| return _dm_task_set_name_from_path(dmt, name, pos + 1);
# 674|
Error: COMPILER_WARNING (CWE-704):
LVM2.2.03.34/libdm/libdm-common.c:672:18: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 670|
# 671| /* Path supplied for existing device? */
# 672|-> if ((pos = strrchr(name, '/')))
# 673| return _dm_task_set_name_from_path(dmt, name, pos + 1);
# 674|
Error: COMPILER_WARNING (CWE-704):
LVM2.2.03.34/libdm/libdm-common.c: scope_hint: In function ‘_mountinfo_parse_line’
LVM2.2.03.34/libdm/libdm-common.c:1767:37: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1767 | if (*maj == 0 && (devmapper = strstr(line, "/dev/mapper/"))) {
# | ^
# 1765| /* btrfs fakes device numbers, but there is still /dev/mapper name
# 1766| * placed in mountinfo, so try to detect proper major:minor via this */
# 1767|-> if (*maj == 0 && (devmapper = strstr(line, "/dev/mapper/"))) {
# 1768| if (!(dmt = dm_task_create(DM_DEVICE_INFO))) {
# 1769| log_error("Mount info task creation failed.");
Error: COMPILER_WARNING (CWE-704):
LVM2.2.03.34/libdm/libdm-common.c:1767:37: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 1765| /* btrfs fakes device numbers, but there is still /dev/mapper name
# 1766| * placed in mountinfo, so try to detect proper major:minor via this */
# 1767|-> if (*maj == 0 && (devmapper = strstr(line, "/dev/mapper/"))) {
# 1768| if (!(dmt = dm_task_create(DM_DEVICE_INFO))) {
# 1769| log_error("Mount info task creation failed.");
Error: COMPILER_WARNING (CWE-704):
LVM2.2.03.34/libdm/libdm-stats.c: scope_hint: In function ‘_stats_parse_histogram_spec’
LVM2.2.03.34/libdm/libdm-stats.c:857:16: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 857 | if ((p = strchr(histogram, '\n')))
# | ^
# 855|
# 856| /* @stats_list rows are newline terminated. */
# 857|-> if ((p = strchr(histogram, '\n')))
# 858| *p = '\0';
# 859|
Error: COMPILER_WARNING (CWE-704):
LVM2.2.03.34/libdm/libdm-stats.c:857:16: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 855|
# 856| /* @stats_list rows are newline terminated. */
# 857|-> if ((p = strchr(histogram, '\n')))
# 858| *p = '\0';
# 859|
Error: COMPILER_WARNING (CWE-704):
LVM2.2.03.34/tools/command.c: scope_hint: In function ‘_add_oo_definition_line’
LVM2.2.03.34/tools/command.c:657:15: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 657 | start = strchr(line, ':') + 2;
# | ^
# 655| }
# 656|
# 657|-> start = strchr(line, ':') + 2;
# 658| if (!(oo->line = strdup(start))) {
# 659| log_error("Failed to duplicate line %s.", start);
Error: COMPILER_WARNING (CWE-704):
LVM2.2.03.34/tools/command.c:657:15: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 655| }
# 656|
# 657|-> start = strchr(line, ':') + 2;
# 658| if (!(oo->line = strdup(start))) {
# 659| log_error("Failed to duplicate line %s.", start);
Error: GCC_ANALYZER_WARNING (CWE-401):
LVM2.2.03.34/tools/pvck.c:968:33: warning[-Wanalyzer-malloc-leak]: leak of ‘vgname’
LVM2.2.03.34/tools/pvck.c:885:12: enter_function: entry to ‘_dump_current_text’
LVM2.2.03.34/tools/pvck.c:901:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/tools/pvck.c:915:13: branch_false: ...to here
LVM2.2.03.34/tools/pvck.c:939:22: call_function: calling ‘_read_bytes’ from ‘_dump_current_text’
LVM2.2.03.34/tools/pvck.c:939:22: return_function: returning to ‘_dump_current_text’ from ‘_read_bytes’
LVM2.2.03.34/tools/pvck.c:939:20: branch_true: following ‘true’ branch...
LVM2.2.03.34/tools/pvck.c:947:17: branch_true: ...to here
LVM2.2.03.34/tools/pvck.c:955:12: branch_false: following ‘false’ branch...
LVM2.2.03.34/tools/pvck.c:959:22: branch_false: ...to here
LVM2.2.03.34/tools/pvck.c:959:20: branch_false: following ‘false’ branch...
LVM2.2.03.34/tools/pvck.c:965:29: branch_false: ...to here
LVM2.2.03.34/tools/pvck.c:965:28: branch_true: following ‘true’ branch...
LVM2.2.03.34/tools/pvck.c:966:42: acquire_memory: allocated here
LVM2.2.03.34/tools/pvck.c:967:28: branch_true: following ‘true’ branch...
LVM2.2.03.34/tools/pvck.c:968:33: throw: if ‘dm_config_get_uint32’ throws an exception...
LVM2.2.03.34/tools/pvck.c:968:33: danger: ‘vgname’ leaks here; was allocated at [(17)](sarif:/runs/0/results/35/codeFlows/0/threadFlows/0/locations/16)
# 966| vgname = strdup(cft->root->key);
# 967| if (cft->root && cft->root->child)
# 968|-> dm_config_get_uint32(cft->root->child, "seqno", &seqno);
# 969| }
# 970| config_destroy(cft);
Error: COMPILER_WARNING (CWE-704):
LVM2.2.03.34/tools/toollib.c: scope_hint: In function ‘_extract_vgname’
LVM2.2.03.34/tools/toollib.c:411:23: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 411 | if ((st = pos = strchr(vg_name, '/')))
# | ^
# 409|
# 410| /* Require exactly one set of consecutive slashes */
# 411|-> if ((st = pos = strchr(vg_name, '/')))
# 412| while (*st == '/')
# 413| st++;
Error: COMPILER_WARNING (CWE-704):
LVM2.2.03.34/tools/toollib.c:411:23: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 409|
# 410| /* Require exactly one set of consecutive slashes */
# 411|-> if ((st = pos = strchr(vg_name, '/')))
# 412| while (*st == '/')
# 413| st++;