mdadm-4.3-3.fc41

List of Defects

Error: CPPCHECK_WARNING: [#def1]
mdadm-4.3-build/mdadm-4.3/Assemble.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def2]
mdadm-4.3-build/mdadm-4.3/Build.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def3]
mdadm-4.3-build/mdadm-4.3/Create.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def4]
mdadm-4.3-build/mdadm-4.3/Create.c:575:17: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv'
#  573|   			} else {
#  574|   				st = super_by_fd(fd, NULL);
#  575|-> 				if (st && !(rv = st->ss->
#  576|   					    load_container(st, fd,
#  577|   							   devlist->devname)))

Error: CPPCHECK_WARNING: [#def5]
mdadm-4.3-build/mdadm-4.3/Detail.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def6]
mdadm-4.3-build/mdadm-4.3/Detail.c:105:8: warning[core.NullDereference]: Dereference of null pointer
#  103|   	if (md_get_array_info(fd, &array)) {
#  104|   		if (errno == ENODEV) {
#  105|-> 			if (sra->array.major_version == -1 &&
#  106|   			    sra->array.minor_version == -1 &&
#  107|   			    sra->devs == NULL) {

Error: CLANG_WARNING: [#def7]
mdadm-4.3-build/mdadm-4.3/Detail.c:141:10: warning[core.NullDereference]: Access to field 'ss' results in a dereference of a null pointer (loaded from variable 'st')
#  139|   		cfd = open_dev(st->container_devnm);
#  140|   		if (cfd >= 0) {
#  141|-> 			err = st->ss->load_container(st, cfd, NULL);
#  142|   			close(cfd);
#  143|   			if (err == 0)

Error: CPPCHECK_WARNING: [#def8]
mdadm-4.3-build/mdadm-4.3/Dump.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def9]
mdadm-4.3-build/mdadm-4.3/Dump.c:244:3: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
#  242|   			return 1;
#  243|   		}
#  244|-> 		closedir(d);
#  245|   		if (!chosen) {
#  246|   			/* One last chance: try basename of device */

Error: GCC_ANALYZER_WARNING (CWE-688): [#def10]
mdadm-4.3-build/mdadm-4.3/Dump.c: scope_hint: In function ‘Restore_metadata’
mdadm-4.3-build/mdadm-4.3/Dump.c:244:17: warning[-Wanalyzer-null-argument]: use of NULL ‘opendir(dir)’ where non-null expected
/usr/include/sys/dir.h:23: included_from: Included from here.
mdadm-4.3-build/mdadm-4.3/Dump.c:21: included_from: Included from here.
/usr/include/dirent.h:134:12: note: argument 1 of ‘closedir’ must be non-null
#  242|   			return 1;
#  243|   		}
#  244|-> 		closedir(d);
#  245|   		if (!chosen) {
#  246|   			/* One last chance: try basename of device */

Error: CLANG_WARNING: [#def11]
mdadm-4.3-build/mdadm-4.3/Grow.c:469:9: warning[unix.Malloc]: Use of memory after it is freed
#  467|   			}
#  468|   			rv = sysfs_set_num_signed(mdi, NULL, "bitmap/location",
#  469|-> 						  mdi->bitmap_offset);
#  470|   			free(mdi);
#  471|   		} else {

Error: CLANG_WARNING: [#def12]
mdadm-4.3-build/mdadm-4.3/Grow.c:2080:6: warning[deadcode.DeadStores]: Value stored to 'rv' is never read
# 2078|   					 * to change one parameter at time only
# 2079|   					 */
# 2080|-> 					rv = md_get_array_info(fd, &array);
# 2081|   				}
# 2082|   			}

Error: CLANG_WARNING: [#def13]
mdadm-4.3-build/mdadm-4.3/Grow.c:4657:3: warning[core.CallAndMessage]: 4th function call argument is an uninitialized value
# 4655|   
# 4656|   	if (reshape->before.data_disks == reshape->after.data_disks)
# 4657|-> 		sysfs_set_num(sra, NULL, "sync_speed_min", speed);
# 4658|   	free(buf);
# 4659|   	return done;

Error: CLANG_WARNING: [#def14]
mdadm-4.3-build/mdadm-4.3/Grow.c:4705:9: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
# 4703|   		 */
# 4704|   		if (i == old_disks-1) {
# 4705|-> 			fd = open(backup_file, O_RDONLY);
# 4706|   			if (fd<0) {
# 4707|   				pr_err("backup file %s inaccessible: %s\n",

Error: CPPCHECK_WARNING: [#def15]
mdadm-4.3-build/mdadm-4.3/Incremental.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-465): [#def16]
mdadm-4.3-build/mdadm-4.3/Incremental.c: scope_hint: In function ‘Incremental’
mdadm-4.3-build/mdadm-4.3/Incremental.c:144:15: warning[-Wanalyzer-deref-before-check]: check of ‘devlist’ for NULL after already dereferencing it
#  142|   	/* 1/ Check if device is permitted by mdadm.conf */
#  143|   
#  144|-> 	for (;devlist; devlist = devlist->next)
#  145|   		if (conf_test_dev(devlist->devname))
#  146|   			break;

Error: CLANG_WARNING: [#def17]
mdadm-4.3-build/mdadm-4.3/Incremental.c:790:36: warning[core.NullDereference]: Access to field 'next' results in a dereference of a null pointer (loaded from variable 'd')
#  788|   				 * don't use it */
#  789|   				devnum = best[i];
#  790|-> 				for (d=sra->devs ; devnum; d = d->next)
#  791|   					devnum--;
#  792|   				d->disk.state |= (1 << MD_DISK_REMOVED);

Error: CLANG_WARNING: [#def18]
mdadm-4.3-build/mdadm-4.3/Incremental.c:792:19: warning[core.NullDereference]: Dereference of null pointer
#  790|   				for (d=sra->devs ; devnum; d = d->next)
#  791|   					devnum--;
#  792|-> 				d->disk.state |= (1 << MD_DISK_REMOVED);
#  793|   				avail[i] = 0;
#  794|   			}

Error: CLANG_WARNING: [#def19]
mdadm-4.3-build/mdadm-4.3/Incremental.c:1618:4: warning[deadcode.DeadStores]: Value stored to 'sep' is never read
# 1616|   		if (result & INCR_YES) {
# 1617|   			printf("%cyes", sep);
# 1618|-> 			sep = ',';
# 1619|   		}
# 1620|   		printf("\n");

Error: CPPCHECK_WARNING: [#def20]
mdadm-4.3-build/mdadm-4.3/Kill.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def21]
mdadm-4.3-build/mdadm-4.3/Manage.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def22]
mdadm-4.3-build/mdadm-4.3/Manage.c:68:5: warning[deadcode.DeadStores]: Value stored to 'rv' is never read
#   66|   				vers[9] = mdi->text_version[0];
#   67|   				sysfs_set_str(mdi, NULL, "metadata_version", vers);
#   68|-> 				rv = 1;
#   69|   				goto out;
#   70|   			}

Error: CLANG_WARNING: [#def23]
mdadm-4.3-build/mdadm-4.3/Manage.c:1092:4: warning[deadcode.DeadStores]: Value stored to 'ret' is never read
# 1090|   		 */
# 1091|   		if (rdev == 0)
# 1092|-> 			ret = -1;
# 1093|   		else {
# 1094|   			/*

Error: CLANG_WARNING: [#def24]
mdadm-4.3-build/mdadm-4.3/Manage.c:1456:5: warning[deadcode.DeadStores]: Value stored to 'rv' is never read
# 1454|   			struct mddev_dev **dp;
# 1455|   			if (dv->disposition == 'c') {
# 1456|-> 				rv = ioctl(fd, CLUSTERED_DISK_NACK, NULL);
# 1457|   				break;
# 1458|   			}

Error: CLANG_WARNING: [#def25]
mdadm-4.3-build/mdadm-4.3/Manage.c:1633:4: warning[deadcode.DeadStores]: Value stored to 'tfd' is never read
# 1631|   					rdev, array_size, raid_slot);
# 1632|   			close(tfd);
# 1633|-> 			tfd = -1;
# 1634|   			if (rv < 0)
# 1635|   				goto abort;

Error: CPPCHECK_WARNING: [#def26]
mdadm-4.3-build/mdadm-4.3/Monitor.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def27]
mdadm-4.3-build/mdadm-4.3/Monitor.c:669:3: warning[deadcode.DeadStores]: Value stored to 'n' is never read
#  667|   	fprintf(mp, "The /proc/mdstat file currently contains the following:\n\n");
#  668|   	while ((n = fread(buf, 1, sizeof(buf), mdstat)) > 0)
#  669|-> 		n = fwrite(buf, 1, n, mp);
#  670|   	fclose(mdstat);
#  671|   	pclose(mp);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def28]
mdadm-4.3-build/mdadm-4.3/Monitor.c: scope_hint: In function ‘add_new_arrays’
mdadm-4.3-build/mdadm-4.3/Monitor.c:998:37: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘sl’
mdadm-4.3-build/mdadm-4.3/Monitor.c: scope_hint: In function ‘add_new_arrays’
#  996|   					 "%s", mse->metadata_version + 10);
#  997|   				sl = strchr(st->parent_devnm, '/');
#  998|-> 				*sl = 0;
#  999|   			} else
# 1000|   				st->parent_devnm[0] = 0;

Error: CPPCHECK_WARNING: [#def29]
mdadm-4.3-build/mdadm-4.3/Query.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def30]
mdadm-4.3-build/mdadm-4.3/Query.c:95:15: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value
#   93|   	else {
#   94|   		printf("%s: %s %s %d devices, %d spare%s. Use mdadm --detail for more detail.\n",
#   95|-> 		       dev, human_size_brief(larray_size,IEC),
#   96|   		       map_num_s(pers, level), raid_disks,
#   97|   		       spare_disks, spare_disks == 1 ? "" : "s");

Error: CPPCHECK_WARNING: [#def31]
mdadm-4.3-build/mdadm-4.3/ReadMe.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def32]
mdadm-4.3-build/mdadm-4.3/bitmap.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def33]
mdadm-4.3-build/mdadm-4.3/bitmap.c:332:24: warning[unix.Malloc]: Use of memory after it is freed
#  330|   		printf("   Cluster nodes : %d\n", sb->nodes);
#  331|   		printf("    Cluster name : %-64s\n", sb->cluster_name);
#  332|-> 		for (i = 0; i < (int)sb->nodes; i++) {
#  333|   			st = NULL;
#  334|   			free(info);

Error: CPPCHECK_WARNING: [#def34]
mdadm-4.3-build/mdadm-4.3/config.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def35]
mdadm-4.3-build/mdadm-4.3/lib.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def36]
mdadm-4.3-build/mdadm-4.3/managemon.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def37]
mdadm-4.3-build/mdadm-4.3/mapfile.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def38]
mdadm-4.3-build/mdadm-4.3/mdadm.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-775): [#def39]
mdadm-4.3-build/mdadm-4.3/mdadm.c: scope_hint: In function ‘main’
mdadm-4.3-build/mdadm-4.3/mdadm.c:1060:30: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(optarg, 2)’
mdadm-4.3-build/mdadm-4.3/mdadm.c:368:25: note: in expansion of macro ‘O’
# 1058|   			}
# 1059|   			bitmap_fd = open(optarg, O_RDWR);
# 1060|-> 			if (!*optarg || bitmap_fd < 0) {
# 1061|   				pr_err("cannot open bitmap file %s: %s\n", optarg, strerror(errno));
# 1062|   				exit(2);

Error: CPPCHECK_WARNING: [#def40]
mdadm-4.3-build/mdadm-4.3/mdmon.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def41]
mdadm-4.3-build/mdadm-4.3/mdmon.c:203:2: warning[deadcode.DeadStores]: Value stored to 'n' is never read
#  201|   	fl &= ~O_NONBLOCK;
#  202|   	fcntl(sock, F_SETFL, fl);
#  203|-> 	n = read(sock, buf, 100);
#  204|   
#  205|   	/* If there is I/O going on it might took some time to get to

Error: GCC_ANALYZER_WARNING (CWE-775): [#def42]
mdadm-4.3-build/mdadm-4.3/mdmon.c:446:24: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘pfd[0]’
#  444|   	if (mdfd < 0) {
#  445|   		pr_err("%s: %s\n", devnm, strerror(errno));
#  446|-> 		return 1;
#  447|   	}
#  448|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def43]
mdadm-4.3-build/mdadm-4.3/mdmon.c: scope_hint: In function ‘mdmon’
mdadm-4.3-build/mdadm-4.3/mdmon.c:446:24: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘pfd[1]’
#  444|   	if (mdfd < 0) {
#  445|   		pr_err("%s: %s\n", devnm, strerror(errno));
#  446|-> 		return 1;
#  447|   	}
#  448|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def44]
mdadm-4.3-build/mdadm-4.3/mdmon.c:446:24: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘pfd[status]’
mdadm-4.3-build/mdadm-4.3/mdmon.c: scope_hint: In function ‘mdmon’
#  444|   	if (mdfd < 0) {
#  445|   		pr_err("%s: %s\n", devnm, strerror(errno));
#  446|-> 		return 1;
#  447|   	}
#  448|   

Error: CPPCHECK_WARNING: [#def45]
mdadm-4.3-build/mdadm-4.3/mdopen.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def46]
mdadm-4.3-build/mdadm-4.3/mdstat.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def47]
mdadm-4.3-build/mdadm-4.3/monitor.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def48]
mdadm-4.3-build/mdadm-4.3/monitor.c:834:5: warning[deadcode.DeadStores]: Value stored to 'rv' is never read
#  832|   		if (rv == -1) {
#  833|   			if (errno == EINTR) {
#  834|-> 				rv = 0;
#  835|   				FD_ZERO(&rfds);
#  836|   				dprintf("monitor: caught signal\n");

Error: CPPCHECK_WARNING: [#def49]
mdadm-4.3-build/mdadm-4.3/msg.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def50]
mdadm-4.3-build/mdadm-4.3/msg.c:89:3: warning[deadcode.DeadStores]: Value stored to 'rv' is never read
#   87|   	rv = rv ?: send_buf(fd, &len, 4, tmo);
#   88|   	if (len > 0)
#   89|-> 		rv = rv ?: send_buf(fd, msg->buf, msg->len, tmo);
#   90|   	rv = send_buf(fd, &end_magic, 4, tmo);
#   91|   

Error: CPPCHECK_WARNING: [#def51]
mdadm-4.3-build/mdadm-4.3/platform-intel.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING (CWE-758): [#def52]
mdadm-4.3-build/mdadm-4.3/platform-intel.c:460: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
#  458|   		.vphba = IMSM_OROM_VOLUMES_PER_HBA
#  459|   	};
#  460|-> 	orom.attr = orom.rlc | IMSM_OROM_ATTR_ChecksumVerify;
#  461|   
#  462|   	if (check_env("IMSM_TEST_OROM_NORAID5")) {

Error: CPPCHECK_WARNING: [#def53]
mdadm-4.3-build/mdadm-4.3/policy.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def54]
mdadm-4.3-build/mdadm-4.3/policy.c:92:8: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
#   90|   		return 0;
#   91|   
#   92|-> 	cmp = strcmp(a->value, b->value);
#   93|   	if (cmp < 0)
#   94|   		return 1;

Error: CLANG_WARNING: [#def55]
mdadm-4.3-build/mdadm-4.3/policy.c:340:9: warning[core.NonNullParamChecker]: Null pointer passed to 2nd parameter expecting 'nonnull'
#  338|   			for (dom = dl_next(r->dups); dom != r->dups;
#  339|   			     dom = dl_next(dom))
#  340|-> 				if (strcmp(dom+len+1, part)== 0)
#  341|   					break;
#  342|   			if (dom == r->dups) {

Error: GCC_ANALYZER_WARNING (CWE-688): [#def56]
mdadm-4.3-build/mdadm-4.3/policy.c: scope_hint: In function ‘pol_merge_part’
mdadm-4.3-build/mdadm-4.3/policy.c:340:37: warning[-Wanalyzer-null-argument]: use of NULL ‘part’ where non-null expected
mdadm-4.3-build/mdadm-4.3/mdadm.h:53: included_from: Included from here.
mdadm-4.3-build/mdadm-4.3/policy.c:25: included_from: Included from here.
mdadm-4.3-build/mdadm-4.3/mdadm.h:48: included_from: Included from here.
/usr/include/string.h:156:12: note: argument 2 of ‘strcmp’ must be non-null
#  338|   			for (dom = dl_next(r->dups); dom != r->dups;
#  339|   			     dom = dl_next(dom))
#  340|-> 				if (strcmp(dom+len+1, part)== 0)
#  341|   					break;
#  342|   			if (dom == r->dups) {

Error: CLANG_WARNING: [#def57]
mdadm-4.3-build/mdadm-4.3/policy.c:344:26: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
#  342|   			if (dom == r->dups) {
#  343|   				char *newdom = dl_strndup(
#  344|-> 					r->value, len + 1 + strlen(part));
#  345|   				strcat(strcat(newdom, "-"), part);
#  346|   				dl_add(r->dups, newdom);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def58]
mdadm-4.3-build/mdadm-4.3/policy.c:344:61: warning[-Wanalyzer-null-argument]: use of NULL ‘part’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null
#  342|   			if (dom == r->dups) {
#  343|   				char *newdom = dl_strndup(
#  344|-> 					r->value, len + 1 + strlen(part));
#  345|   				strcat(strcat(newdom, "-"), part);
#  346|   				dl_add(r->dups, newdom);

Error: CPPCHECK_WARNING: [#def59]
mdadm-4.3-build/mdadm-4.3/probe_roms.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-465): [#def60]
mdadm-4.3-build/mdadm-4.3/probe_roms.c: scope_hint: In function ‘probe_roms’
mdadm-4.3-build/mdadm-4.3/probe_roms.c:316:20: warning[-Wanalyzer-deref-before-check]: check of ‘res’ for NULL after already dereferencing it
mdadm-4.3-build/mdadm-4.3/probe_roms.c: scope_hint: In function ‘probe_roms’
mdadm-4.3-build/mdadm-4.3/probe_roms.c: scope_hint: In function ‘probe_roms’
mdadm-4.3-build/mdadm-4.3/probe_roms.c: scope_hint: In function ‘probe_roms’
#  314|   			continue;
#  315|   
#  316|-> 		if (res == NULL) {
#  317|   			res = calloc(1, sizeof(struct resource));
#  318|   			if (res == NULL)

Error: CLANG_WARNING: [#def61]
mdadm-4.3-build/mdadm-4.3/raid6check.c:192:5: warning[core.VLASize]: Declared variable-length array (VLA) has negative size
#  190|   			}
#  191|   			else {
#  192|-> 				char *all_but_failed_blocks[syndrome_disks];
#  193|   				for(i = 0; i < syndrome_disks; i++) {
#  194|   					if (i == disk[j])

Error: CLANG_WARNING: [#def62]
mdadm-4.3-build/mdadm-4.3/raid6check.c:192:5: warning[core.VLASize]: Declared variable-length array (VLA) has zero size
#  190|   			}
#  191|   			else {
#  192|-> 				char *all_but_failed_blocks[syndrome_disks];
#  193|   				for(i = 0; i < syndrome_disks; i++) {
#  194|   					if (i == disk[j])

Error: CLANG_WARNING: [#def63]
mdadm-4.3-build/mdadm-4.3/raid6check.c:443:4: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined
#  441|   
#  442|   		for(j = 0; j < (chunk_size >> CHECK_PAGE_BITS); j++) {
#  443|-> 			int role = disk[j];
#  444|   			if (role >= -2) {
#  445|   				int slot = block_index_for_slot[role];

Error: CPPCHECK_WARNING: [#def64]
mdadm-4.3-build/mdadm-4.3/restripe.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-457): [#def65]
mdadm-4.3-build/mdadm-4.3/restripe.c: scope_hint: In function ‘save_stripes’
mdadm-4.3-build/mdadm-4.3/restripe.c:598:47: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘fblock[1]’
#  596|   			/* all data disks are good */
#  597|   			;
#  598|-> 		else if (failed == 1 || fblock[1] >= data_disks+1) {
#  599|   			/* one failed data disk and good parity */
#  600|   			char *bufs[data_disks];

Error: CLANG_WARNING: [#def66]
mdadm-4.3-build/mdadm-4.3/restripe.c:777:29: warning[core.DivideZero]: Division by zero
#  775|   		}
#  776|   		/* We have the data, now do the parity */
#  777|-> 		offset = (start/chunk_size/data_disks) * chunk_size;
#  778|   		switch (level) {
#  779|   		case 4:

Error: CPPCHECK_WARNING: [#def67]
mdadm-4.3-build/mdadm-4.3/super-ddf.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING (CWE-457): [#def68]
mdadm-4.3-build/mdadm-4.3/super-ddf.c:1604: error[legacyUninitvar]: Uninitialized variable: end
# 1602|   	if (sub != NULL)
# 1603|   		vcnum = strtoul(sub + 1, &end, 10);
# 1604|-> 	if (sub == NULL || *sub == '\0' || *end != '\0' ||
# 1605|   	    vcnum >= be16_to_cpu(ddf->active->max_vd_entries)) {
# 1606|   		sysfs_free(sra);

Error: CPPCHECK_WARNING (CWE-457): [#def69]
mdadm-4.3-build/mdadm-4.3/super-ddf.c:1605: error[legacyUninitvar]: Uninitialized variable: vcnum
# 1603|   		vcnum = strtoul(sub + 1, &end, 10);
# 1604|   	if (sub == NULL || *sub == '\0' || *end != '\0' ||
# 1605|-> 	    vcnum >= be16_to_cpu(ddf->active->max_vd_entries)) {
# 1606|   		sysfs_free(sra);
# 1607|   		return DDF_NOTFOUND;

Error: CPPCHECK_WARNING: [#def70]
mdadm-4.3-build/mdadm-4.3/super-gpt.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def71]
mdadm-4.3-build/mdadm-4.3/super-intel.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING (CWE-457): [#def72]
mdadm-4.3-build/mdadm-4.3/super-intel.c:8346: error[legacyUninitvar]: Uninitialized variable: insync
# 8344|   		int i;
# 8345|   		/* gcc -Os complains that this is unused */
# 8346|-> 		int insync = insync;
# 8347|   
# 8348|   		for (i = 0; i < map->num_members; i++) {

Error: CPPCHECK_WARNING: [#def73]
mdadm-4.3-build/mdadm-4.3/super0.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def74]
mdadm-4.3-build/mdadm-4.3/super1.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-476): [#def75]
mdadm-4.3-build/mdadm-4.3/super1.c: scope_hint: In function ‘load_super1’
mdadm-4.3-build/mdadm-4.3/super1.c:2237:51: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘tst.sb’
mdadm-4.3-build/mdadm-4.3/super1.c:26: included_from: Included from here.
mdadm-4.3-build/mdadm-4.3/mdadm.h:1826:36: note: in definition of macro ‘_ROUND_UP’
mdadm-4.3-build/mdadm-4.3/mdadm.h:1829:35: note: in expansion of macro ‘ROUND_UP’
mdadm-4.3-build/mdadm-4.3/super1.c:256:13: note: in expansion of macro ‘ROUND_UP_PTR’
mdadm-4.3-build/mdadm-4.3/mdadm.h:1826:36: note: in definition of macro ‘_ROUND_UP’
mdadm-4.3-build/mdadm-4.3/mdadm.h:1829:35: note: in expansion of macro ‘ROUND_UP’
mdadm-4.3-build/mdadm-4.3/super1.c:256:13: note: in expansion of macro ‘ROUND_UP_PTR’
# 2235|   				    bestctime < __le64_to_cpu(super->ctime)) {
# 2236|   					bestvers = tst.minor_version;
# 2237|-> 					bestctime = __le64_to_cpu(super->ctime);
# 2238|   				}
# 2239|   				free(super);

Error: CPPCHECK_WARNING: [#def76]
mdadm-4.3-build/mdadm-4.3/sysfs.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def77]
mdadm-4.3-build/mdadm-4.3/sysfs.c:1001:12: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
#  999|   				match = strcmp(devnm, rules->devname) == 0;
# 1000|   		} else {
# 1001|-> 			match = memcmp(dev->uuid, rules->uuid,
# 1002|   				       sizeof(int[4])) == 0;
# 1003|   		}

Error: CPPCHECK_WARNING: [#def78]
mdadm-4.3-build/mdadm-4.3/util.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-775): [#def79]
mdadm-4.3-build/mdadm-4.3/util.c: scope_hint: In function ‘manage_fork_fds’
mdadm-4.3-build/mdadm-4.3/util.c:2211:9: warning[-Wanalyzer-fd-leak]: leak of file descriptor
# 2209|   
# 2210|   	close(0);
# 2211|-> 	open("/dev/null", O_RDWR);
# 2212|   
# 2213|   #ifndef DEBUG

Error: GCC_ANALYZER_WARNING (CWE-910): [#def80]
mdadm-4.3-build/mdadm-4.3/util.c:2214:9: warning[-Wanalyzer-fd-use-after-close]: ‘dup2’ on closed file descriptor ‘0’
# 2212|   
# 2213|   #ifndef DEBUG
# 2214|-> 	dup2(0, 1);
# 2215|   	dup2(0, 2);
# 2216|   #endif

Error: GCC_ANALYZER_WARNING (CWE-910): [#def81]
mdadm-4.3-build/mdadm-4.3/util.c:2215:9: warning[-Wanalyzer-fd-use-after-close]: ‘dup2’ on closed file descriptor ‘0’
# 2213|   #ifndef DEBUG
# 2214|   	dup2(0, 1);
# 2215|-> 	dup2(0, 2);
# 2216|   #endif
# 2217|   

Error: CPPCHECK_WARNING: [#def82]
mdadm-4.3-build/mdadm-4.3/uuid.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Scan Properties

analyzer-version-clang18.1.7
analyzer-version-cppcheck2.14.2
analyzer-version-gcc14.1.1
analyzer-version-gcc-analyzer14.1.1
analyzer-version-shellcheck0.10.0
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-56.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-namemdadm-4.3-3.fc41
store-results-to/tmp/tmpnzoj29a0/mdadm-4.3-3.fc41.tar.xz
time-created2024-07-03 16:12:42
time-finished2024-07-03 16:14:30
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpnzoj29a0/mdadm-4.3-3.fc41.tar.xz' '--gcc-analyze' '/tmp/tmpnzoj29a0/mdadm-4.3-3.fc41.src.rpm'
tool-versioncsmock-3.5.3-1.el9