Newly introduced defects

List of Defects

Error: CLANG_WARNING: [#def1]
xfsprogs-6.8.0-build/xfsprogs-6.8.0/libxfs/xfs_attr_leaf.c:730:27: warning[deadcode.DeadStores]: Value stored to 'sf' during its initialization is never read
#  728|   	struct xfs_mount		*mp = dp->i_mount;
#  729|   	struct xfs_ifork		*ifp = &dp->i_af;
#  730|-> 	struct xfs_attr_sf_hdr		*sf = ifp->if_data;
#  731|   	struct xfs_attr_sf_entry	*sfe;
#  732|   	int				size;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def2]
xfsprogs-6.8.0-build/xfsprogs-6.8.0/libxfs/xfs_bmap_btree.c: scope_hint: In function 'libxfs_bmbt_commit_staged_btree'
xfsprogs-6.8.0-build/xfsprogs-6.8.0/libxfs/xfs_bmap_btree.c:653:9: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected
<built-in>: note: argument 1 of '__builtin_memcpy' must be non-null
#  651|   	ifp = xfs_ifork_ptr(cur->bc_ino.ip, whichfork);
#  652|   	xfs_idestroy_fork(ifp);
#  653|-> 	memcpy(ifp, ifake->if_fork, sizeof(struct xfs_ifork));
#  654|   
#  655|   	switch (ifp->if_format) {

Error: CLANG_WARNING: [#def3]
xfsprogs-6.8.0-build/xfsprogs-6.8.0/libxfs/xfs_bmap_btree.c:657:9: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined
#  655|   	switch (ifp->if_format) {
#  656|   	case XFS_DINODE_FMT_EXTENTS:
#  657|-> 		flags |= extflag[whichfork];
#  658|   		break;
#  659|   	case XFS_DINODE_FMT_BTREE:

Error: CLANG_WARNING: [#def4]
xfsprogs-6.8.0-build/xfsprogs-6.8.0/libxfs/xfs_bmap_btree.c:660:9: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined
#  658|   		break;
#  659|   	case XFS_DINODE_FMT_BTREE:
#  660|-> 		flags |= brootflag[whichfork];
#  661|   		break;
#  662|   	default:

Error: CLANG_WARNING: [#def5]
xfsprogs-6.8.0-build/xfsprogs-6.8.0/libxfs/xfs_da_btree.c:698:2: warning[deadcode.DeadStores]: Value stored to 'node' is never read
#  696|   	if (error)
#  697|   		return error;
#  698|-> 	node = bp->b_addr;
#  699|   	oldroot = blk1->bp->b_addr;
#  700|   	if (oldroot->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC) ||

Error: GCC_ANALYZER_WARNING (CWE-476): [#def6]
xfsprogs-6.8.0-build/xfsprogs-6.8.0/libxfs/xfs_inode_fork.c: scope_hint: In function 'xfs_iext_count_may_overflow'
xfsprogs-6.8.0-build/xfsprogs-6.8.0/libxfs/xfs_inode_fork.c:773:22: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
xfsprogs-6.8.0-build/xfsprogs-6.8.0/libxfs/xfs_inode_fork.c: scope_hint: In function 'xfs_iext_count_may_overflow'
#  771|   		max_exts = 10;
#  772|   
#  773|-> 	nr_exts = ifp->if_nextents + nr_to_add;
#  774|   	if (nr_exts < ifp->if_nextents || nr_exts > max_exts)
#  775|   		return -EFBIG;

Error: CLANG_WARNING: [#def7]
xfsprogs-6.8.0-build/xfsprogs-6.8.0/mdrestore/xfs_mdrestore.c:125:6: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
#  123|   	*is_file = false;
#  124|   
#  125|-> 	if (stat(path, &statbuf) < 0)  {
#  126|   		/* ok, assume it's a file and create it */
#  127|   		open_flags |= O_CREAT;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def8]
xfsprogs-6.8.0-build/xfsprogs-6.8.0/mdrestore/xfs_mdrestore.c: scope_hint: In function ‘open_device’
xfsprogs-6.8.0-build/xfsprogs-6.8.0/mdrestore/xfs_mdrestore.c:125:13: warning[-Wanalyzer-null-argument]: use of NULL ‘path’ where non-null expected
xfsprogs-6.8.0-build/xfsprogs-6.8.0/include/libxfs.h:30: included_from: Included from here.
xfsprogs-6.8.0-build/xfsprogs-6.8.0/mdrestore/xfs_mdrestore.c:7: included_from: Included from here.
xfsprogs-6.8.0-build/xfsprogs-6.8.0/include/xfs_arch.h:134:31: note: in definition of macro ‘__swab32’
xfsprogs-6.8.0-build/xfsprogs-6.8.0/mdrestore/xfs_mdrestore.c:555:17: note: in expansion of macro ‘be32_to_cpu’
/usr/include/features.h:511: included_from: Included from here.
/usr/include/bits/libc-header-start.h:33: included_from: Included from here.
/usr/include/stdio.h:28: included_from: Included from here.
xfsprogs-6.8.0-build/xfsprogs-6.8.0/include/platform_defs.h:9: included_from: Included from here.
xfsprogs-6.8.0-build/xfsprogs-6.8.0/include/libxfs.h:14: included_from: Included from here.
/usr/include/sys/stat.h:227:12: note: argument 1 of ‘stat’ must be non-null
#  123|   	*is_file = false;
#  124|   
#  125|-> 	if (stat(path, &statbuf) < 0)  {
#  126|   		/* ok, assume it's a file and create it */
#  127|   		open_flags |= O_CREAT;

Error: CLANG_WARNING: [#def9]
xfsprogs-6.8.0-build/xfsprogs-6.8.0/mdrestore/xfs_mdrestore.c:407:6: warning[unix.StdCLibraryFunctions]: The 1st argument to 'fread' is NULL but should not be NULL
#  405|   	len = BBTOB(be32_to_cpu(xme.xme_len));
#  406|   
#  407|-> 	if (fread(block_buffer, len, 1, md_fp) != 1)
#  408|   		fatal("error reading from metadump file\n");
#  409|   

Error: CLANG_WARNING: [#def10]
xfsprogs-6.8.0-build/xfsprogs-6.8.0/mdrestore/xfs_mdrestore.c:415:50: warning[core.NullDereference]: Access to field 'sb_inprogress' results in a dereference of a null pointer (loaded from variable 'block_buffer')
#  413|   		fatal("bad magic number for primary superblock\n");
#  414|   
#  415|-> 	((struct xfs_dsb *)block_buffer)->sb_inprogress = 1;
#  416|   
#  417|   	verify_device_size(ddev_fd, is_data_target_file, sb.sb_dblocks,

Error: CLANG_WARNING: [#def11]
xfsprogs-6.8.0-build/xfsprogs-6.8.0/mdrestore/xfs_mdrestore.c:461:3: warning[core.CallAndMessage]: 2nd function call argument is an uninitialized value
#  459|   		len = BBTOB(be32_to_cpu(xme.xme_len));
#  460|   
#  461|-> 		restore_meta_extent(md_fp, fd, device, block_buffer, offset,
#  462|   				len);
#  463|   

Error: CLANG_WARNING: [#def12]
xfsprogs-6.8.0-build/xfsprogs-6.8.0/mkfs/xfs_mkfs.c:3180:19: warning[core.BitwiseShift]: Right operand is negative in left shift
# 3178|   	try_threads = nr_threads;
# 3179|   	try_agsize = cfg->dblocks / try_threads;
# 3180|-> 	if (try_agsize < GIGABYTES(4, cfg->blocklog)) {
# 3181|   		do {
# 3182|   			try_threads--;

Error: CLANG_WARNING: [#def13]
xfsprogs-6.8.0-build/xfsprogs-6.8.0/repair/bulkload.c:247:2: warning[unix.Malloc]: Use of memory after it is freed
#  245|   	 * reservations.
#  246|   	 */
#  247|-> 	list_for_each_entry_safe(resv, n, &bkl->resv_list, list) {
#  248|   		list_del(&resv->list);
#  249|   		libxfs_perag_put(resv->pag);

Error: CLANG_WARNING: [#def14]
xfsprogs-6.8.0-build/xfsprogs-6.8.0/repair/dinode.c:2941:2: warning[deadcode.DeadStores]: Value stored to 'dino' is never read
# 2939|   			ino_bpp) != 0)
# 2940|   		goto bad_out;
# 2941|-> 	dino = *dinop;
# 2942|   
# 2943|   	/*

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
diffbase-analyzer-version-clang18.1.7
diffbase-analyzer-version-cppcheck2.14.2
diffbase-analyzer-version-gcc14.1.1
diffbase-analyzer-version-gcc-analyzer14.1.1
diffbase-analyzer-version-shellcheck0.10.0
diffbase-enabled-pluginsclang, cppcheck, gcc, shellcheck
diffbase-exit-code0
diffbase-hostip-172-16-1-151.us-west-2.compute.internal
diffbase-mock-configfedora-41-x86_64
diffbase-project-namexfsprogs-6.5.0-3.fc40
diffbase-store-results-to/tmp/tmp6lm12azn/xfsprogs-6.5.0-3.fc40.tar.xz
diffbase-time-created2024-07-03 18:23:06
diffbase-time-finished2024-07-03 18:28:09
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmp6lm12azn/xfsprogs-6.5.0-3.fc40.tar.xz' '--gcc-analyze' '/tmp/tmp6lm12azn/xfsprogs-6.5.0-3.fc40.src.rpm'
diffbase-tool-versioncsmock-3.5.3-1.el9
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-151.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-namexfsprogs-6.8.0-2.fc41
store-results-to/tmp/tmpuqzhv6yi/xfsprogs-6.8.0-2.fc41.tar.xz
time-created2024-07-03 18:28:35
time-finished2024-07-03 18:33:12
titleNewly introduced defects
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpuqzhv6yi/xfsprogs-6.8.0-2.fc41.tar.xz' '--gcc-analyze' '/tmp/tmpuqzhv6yi/xfsprogs-6.8.0-2.fc41.src.rpm'
tool-versioncsmock-3.5.3-1.el9