Fixed defects

List of Defects

Error: COMPILER_WARNING (CWE-681): [#def1]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/db/hash.c: scope_hint: In function ‘hash_f’
xfsprogs-6.5.0-build/xfsprogs-6.5.0/db/hash.c:76:58: warning[-Wpointer-sign]: pointer targets in passing argument 1 of ‘libxfs_da_hashname’ differ in signedness
#   76 |                         hashval = libxfs_da_hashname(argv[c], strlen(argv[c]));
#      |                                                      ~~~~^~~
#      |                                                          |
#      |                                                          char *
xfsprogs-6.5.0-build/xfsprogs-6.5.0/include/libxfs.h:59: included_from: Included from here.
xfsprogs-6.5.0-build/xfsprogs-6.5.0/db/hash.c:7: included_from: Included from here.
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_da_btree.h:223:37: note: expected ‘const uint8_t *’ {aka ‘const unsigned char *’} but argument is of type ‘char *’
#  223 | uint xfs_da_hashname(const uint8_t *name_string, int name_length);
#      |                      ~~~~~~~~~~~~~~~^~~~~~~~~~~
#   74|   			hashval = libxfs_dir2_hashname(mp, &xname);
#   75|   		} else {
#   76|-> 			hashval = libxfs_da_hashname(argv[c], strlen(argv[c]));
#   77|   		}
#   78|   		dbprintf("0x%x\n", hashval);

Error: COMPILER_WARNING (CWE-681): [#def2]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/db/hash.c: scope_hint: In function ‘collide_dirents’
xfsprogs-6.5.0-build/xfsprogs-6.5.0/db/hash.c:258:36: warning[-Wpointer-sign]: pointer targets in passing argument 2 of ‘openat’ differ in signedness
#  258 |                 newfd = openat(fd, name, O_CREAT, 0600);
#      |                                    ^~~~
#      |                                    |
#      |                                    const unsigned char *
/usr/include/fcntl.h:341: included_from: Included from here.
xfsprogs-6.5.0-build/xfsprogs-6.5.0/include/platform_defs.h:12: included_from: Included from here.
xfsprogs-6.5.0-build/xfsprogs-6.5.0/include/libxfs.h:11: included_from: Included from here.
/usr/include/bits/fcntl2.h:164:31: note: expected ‘const char *’ but argument is of type ‘const unsigned char *’
#  164 | openat (int __fd, const char *__path, int __oflag, ...)
#      |                   ~~~~~~~~~~~~^~~~~~
#  256|   		 * in; the new names will be hardlinks to the first file.
#  257|   		 */
#  258|-> 		newfd = openat(fd, name, O_CREAT, 0600);
#  259|   		if (newfd < 0)
#  260|   			return errno;

Error: COMPILER_WARNING (CWE-681): [#def3]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/db/hash.c:273:25: warning[-Wpointer-sign]: pointer targets in passing argument 1 of ‘strncpy’ differ in signedness
#  273 |                 strncpy(direntname, name, MAXNAMELEN);
#      |                         ^~~~~~~~~~
#      |                         |
#      |                         unsigned char *
/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.5.0-build/xfsprogs-6.5.0/include/platform_defs.h:10: included_from: Included from here.
/usr/include/bits/string_fortified.h:96:17: note: expected ‘char *’ but argument is of type ‘unsigned char *’
#   96 | __NTH (strncpy (__fortify_clang_overload_arg (char *, __restrict, __dest),
#      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  271|   	dname.name = direntname;
#  272|   	for (i = 0; i < nr; i++) {
#  273|-> 		strncpy(direntname, name, MAXNAMELEN);
#  274|   		obfuscate_name(old_hash, namelen, direntname, true);
#  275|   		ASSERT(old_hash == libxfs_dir2_hashname(mp, &dname));

Error: COMPILER_WARNING (CWE-681): [#def4]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/db/hash.c:273:37: warning[-Wpointer-sign]: pointer targets in passing argument 2 of ‘strncpy’ differ in signedness
#  273 |                 strncpy(direntname, name, MAXNAMELEN);
#      |                                     ^~~~
#      |                                     |
#      |                                     const unsigned char *
/usr/include/bits/string_fortified.h:96:1: note: expected ‘const char *’ but argument is of type ‘const unsigned char *’
#   96 | __NTH (strncpy (__fortify_clang_overload_arg (char *, __restrict, __dest),
#      | ^~~~~
#  271|   	dname.name = direntname;
#  272|   	for (i = 0; i < nr; i++) {
#  273|-> 		strncpy(direntname, name, MAXNAMELEN);
#  274|   		obfuscate_name(old_hash, namelen, direntname, true);
#  275|   		ASSERT(old_hash == libxfs_dir2_hashname(mp, &dname));

Error: COMPILER_WARNING (CWE-681): [#def5]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/db/hash.c:278:44: warning[-Wpointer-sign]: pointer targets in passing argument 2 of ‘linkat’ differ in signedness
#  278 |                         error = linkat(fd, name, fd, direntname, 0);
#      |                                            ^~~~
#      |                                            |
#      |                                            const unsigned char *
xfsprogs-6.5.0-build/xfsprogs-6.5.0/include/platform_defs.h:19: included_from: Included from here.
/usr/include/unistd.h:825:46: note: expected ‘const char *’ but argument is of type ‘const unsigned char *’
#  825 | extern int linkat (int __fromfd, const char *__from, int __tofd,
#      |                                  ~~~~~~~~~~~~^~~~~~
#  276|   
#  277|   		if (fd >= 0) {
#  278|-> 			error = linkat(fd, name, fd, direntname, 0);
#  279|   			if (error && errno != EEXIST)
#  280|   				return errno;

Error: COMPILER_WARNING (CWE-681): [#def6]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/db/hash.c:278:54: warning[-Wpointer-sign]: pointer targets in passing argument 4 of ‘linkat’ differ in signedness
#  278 |                         error = linkat(fd, name, fd, direntname, 0);
#      |                                                      ^~~~~~~~~~
#      |                                                      |
#      |                                                      unsigned char *
/usr/include/unistd.h:826:32: note: expected ‘const char *’ but argument is of type ‘unsigned char *’
#  826 |                    const char *__to, int __flags)
#      |                    ~~~~~~~~~~~~^~~~
#  276|   
#  277|   		if (fd >= 0) {
#  278|-> 			error = linkat(fd, name, fd, direntname, 0);
#  279|   			if (error && errno != EEXIST)
#  280|   				return errno;

Error: COMPILER_WARNING (CWE-681): [#def7]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/db/hash.c: scope_hint: In function ‘collide_xattrs’
xfsprogs-6.5.0-build/xfsprogs-6.5.0/db/hash.c:318:26: warning[-Wpointer-sign]: pointer targets in passing argument 1 of ‘snprintf’ differ in signedness
#  318 |                 snprintf(xattrname, MAXNAMELEN + 5, "user.%s", name);
#      |                          ^~~~~~~~~
#      |                          |
#      |                          unsigned char *
/usr/include/bits/stdio2.h:65:1: note: expected ‘char *’ but argument is of type ‘unsigned char *’
#   65 | __NTH (snprintf (char *__restrict __s, size_t __n,
#      | ^~~~~
#  316|   		 * are passed in.
#  317|   		 */
#  318|-> 		snprintf(xattrname, MAXNAMELEN + 5, "user.%s", name);
#  319|   		error = fsetxattr(fd, xattrname, "1", 1, 0);
#  320|   		if (error)

Error: COMPILER_WARNING (CWE-681): [#def8]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/db/hash.c:319:39: warning[-Wpointer-sign]: pointer targets in passing argument 2 of ‘fsetxattr’ differ in signedness
#  319 |                 error = fsetxattr(fd, xattrname, "1", 1, 0);
#      |                                       ^~~~~~~~~
#      |                                       |
#      |                                       unsigned char *
xfsprogs-6.5.0-build/xfsprogs-6.5.0/db/hash.c:16: included_from: Included from here.
/usr/include/sys/xattr.h:54:45: note: expected ‘const char *’ but argument is of type ‘unsigned char *’
#   54 | extern int fsetxattr (int __fd, const char *__name, const void *__value,
#      |                                 ~~~~~~~~~~~~^~~~~~
#  317|   		 */
#  318|   		snprintf(xattrname, MAXNAMELEN + 5, "user.%s", name);
#  319|-> 		error = fsetxattr(fd, xattrname, "1", 1, 0);
#  320|   		if (error)
#  321|   			return errno;

Error: COMPILER_WARNING (CWE-681): [#def9]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/db/hash.c:332:26: warning[-Wpointer-sign]: pointer targets in passing argument 1 of ‘snprintf’ differ in signedness
#  332 |                 snprintf(xattrname, MAXNAMELEN + 5, "user.%s", name);
#      |                          ^~~~~~~~~
#      |                          |
#      |                          unsigned char *
/usr/include/bits/stdio2.h:65:1: note: expected ‘char *’ but argument is of type ‘unsigned char *’
#   65 | __NTH (snprintf (char *__restrict __s, size_t __n,
#      | ^~~~~
#  330|   
#  331|   	for (i = 0; i < nr; i++) {
#  332|-> 		snprintf(xattrname, MAXNAMELEN + 5, "user.%s", name);
#  333|   		obfuscate_name(old_hash, namelen, xattrname + 5, false);
#  334|   		ASSERT(old_hash == libxfs_da_hashname(xattrname + 5, namelen));

Error: COMPILER_WARNING (CWE-681): [#def10]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/db/hash.c:337:47: warning[-Wpointer-sign]: pointer targets in passing argument 2 of ‘fsetxattr’ differ in signedness
#  337 |                         error = fsetxattr(fd, xattrname, "1", 1, 0);
#      |                                               ^~~~~~~~~
#      |                                               |
#      |                                               unsigned char *
/usr/include/sys/xattr.h:54:45: note: expected ‘const char *’ but argument is of type ‘unsigned char *’
#   54 | extern int fsetxattr (int __fd, const char *__name, const void *__value,
#      |                                 ~~~~~~~~~~~~^~~~~~
#  335|   
#  336|   		if (fd >= 0) {
#  337|-> 			error = fsetxattr(fd, xattrname, "1", 1, 0);
#  338|   			if (error)
#  339|   				return errno;

Error: COMPILER_WARNING (CWE-681): [#def11]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/db/hash.c: scope_hint: In function ‘hashcoll_f’
xfsprogs-6.5.0-build/xfsprogs-6.5.0/db/hash.c:417:52: warning[-Wpointer-sign]: pointer targets in passing argument 2 of ‘collide_xattrs’ differ in signedness
#  417 |                         error = collide_xattrs(nr, buf, len, fd);
#      |                                                    ^~~
#      |                                                    |
#      |                                                    char *
xfsprogs-6.5.0-build/xfsprogs-6.5.0/db/hash.c:300:34: note: expected ‘const unsigned char *’ but argument is of type ‘char *’
#  300 |         const unsigned char     *name,
#      |         ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
#  415|   
#  416|   		if (create_xattr)
#  417|-> 			error = collide_xattrs(nr, buf, len, fd);
#  418|   		else
#  419|   			error = collide_dirents(nr, buf, len, fd);

Error: COMPILER_WARNING (CWE-681): [#def12]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/db/hash.c:419:53: warning[-Wpointer-sign]: pointer targets in passing argument 2 of ‘collide_dirents’ differ in signedness
#  419 |                         error = collide_dirents(nr, buf, len, fd);
#      |                                                     ^~~
#      |                                                     |
#      |                                                     char *
xfsprogs-6.5.0-build/xfsprogs-6.5.0/db/hash.c:234:34: note: expected ‘const unsigned char *’ but argument is of type ‘char *’
#  234 |         const unsigned char     *name,
#      |         ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
#  417|   			error = collide_xattrs(nr, buf, len, fd);
#  418|   		else
#  419|-> 			error = collide_dirents(nr, buf, len, fd);
#  420|   		if (error) {
#  421|   			printf(_("hashcoll: %s\n"), strerror(error));

Error: COMPILER_WARNING (CWE-681): [#def13]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/db/hash.c:431:56: warning[-Wpointer-sign]: pointer targets in passing argument 2 of ‘collide_xattrs’ differ in signedness
#  431 |                         error = collide_xattrs(nr, argv[c], len, fd);
#      |                                                    ~~~~^~~
#      |                                                        |
#      |                                                        char *
xfsprogs-6.5.0-build/xfsprogs-6.5.0/db/hash.c:300:34: note: expected ‘const unsigned char *’ but argument is of type ‘char *’
#  300 |         const unsigned char     *name,
#      |         ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
#  429|   
#  430|   		if (create_xattr)
#  431|-> 			error = collide_xattrs(nr, argv[c], len, fd);
#  432|   		else
#  433|   			error = collide_dirents(nr, argv[c], len, fd);

Error: COMPILER_WARNING (CWE-681): [#def14]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/db/hash.c:433:57: warning[-Wpointer-sign]: pointer targets in passing argument 2 of ‘collide_dirents’ differ in signedness
#  433 |                         error = collide_dirents(nr, argv[c], len, fd);
#      |                                                     ~~~~^~~
#      |                                                         |
#      |                                                         char *
xfsprogs-6.5.0-build/xfsprogs-6.5.0/db/hash.c:234:34: note: expected ‘const unsigned char *’ but argument is of type ‘char *’
#  234 |         const unsigned char     *name,
#      |         ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
#  431|   			error = collide_xattrs(nr, argv[c], len, fd);
#  432|   		else
#  433|-> 			error = collide_dirents(nr, argv[c], len, fd);
#  434|   		if (error) {
#  435|   			printf(_("hashcoll: %s\n"), strerror(error));

Error: CLANG_WARNING: [#def15]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_defer.c:6: included_from: Included from here.
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/libxfs_priv.h:44: included_from: Included from here.
xfsprogs-6.5.0-build/xfsprogs-6.5.0/include/list.h:112:13: warning[core.NullDereference]: Access to field 'prev' results in a dereference of a null pointer (loaded from variable 'next')
#  110|   
#  111|   	last->next = next;
#  112|-> 	next->prev = last;
#  113|   }
#  114|   

Error: CLANG_WARNING: [#def16]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_btree.c:6: included_from: Included from here.
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/libxfs_priv.h:88: included_from: Included from here.
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/libxfs_io.h:120:9: warning[core.NullDereference]: Access to field 'b_maps' results in a dereference of a null pointer (loaded from variable 'bp')
#  118|   static inline xfs_daddr_t xfs_buf_daddr(struct xfs_buf *bp)
#  119|   {
#  120|-> 	return bp->b_maps[0].bm_bn;
#  121|   }
#  122|   

Error: CLANG_WARNING: [#def17]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c:6: included_from: Included from here.
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/libxfs_priv.h:244:24: warning[core.DivideZero]: Division by zero
#  242|   div_u64_rem(uint64_t dividend, uint32_t divisor, uint32_t *remainder)
#  243|   {
#  244|-> 	*remainder = dividend % divisor;
#  245|   	return dividend / divisor;
#  246|   }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def18]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c: scope_hint: In function 'xfs_bmap_btree_to_extents'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c:536:34: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c: scope_hint: In function 'xfs_bmap_btree_to_extents'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/libxfs_priv.h:193:34: note: in definition of macro 'unlikely'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c:5666:13: note: in expansion of macro 'XFS_IS_CORRUPT'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c:5666:13: note: in expansion of macro 'XFS_IS_CORRUPT'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/libxfs_priv.h:193:34: note: in definition of macro 'unlikely'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c:5672:13: note: in expansion of macro 'XFS_IS_CORRUPT'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c:5672:13: note: in expansion of macro 'XFS_IS_CORRUPT'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c: scope_hint: In function 'xfs_bmap_btree_to_extents'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/libxfs_priv.h:193:34: note: in definition of macro 'unlikely'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c:5679:13: note: in expansion of macro 'XFS_IS_CORRUPT'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c:5679:13: note: in expansion of macro 'XFS_IS_CORRUPT'
#  534|   	struct xfs_ifork	*ifp = xfs_ifork_ptr(ip, whichfork);
#  535|   	struct xfs_mount	*mp = ip->i_mount;
#  536|-> 	struct xfs_btree_block	*rblock = ifp->if_broot;
#  537|   	struct xfs_btree_block	*cblock;/* child btree block */
#  538|   	xfs_fsblock_t		cbno;	/* child block number */

Error: GCC_ANALYZER_WARNING (CWE-457): [#def19]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c: scope_hint: In function '__xfs_bunmapi'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c:5506:34: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'tmp_logflags'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c: scope_hint: In function '__xfs_bunmapi'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c:5296:13: note: in expansion of macro 'XFS_IS_CORRUPT'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c:5305:17: note: in expansion of macro 'xfs_iread_extents'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c:5305:17: note: in expansion of macro 'xfs_iread_extents'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c:1171:1: note: in expansion of macro 'xfs_iread_extents'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c:5305:17: note: in expansion of macro 'xfs_iread_extents'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c:5314:48: note: in expansion of macro 'XFS_IS_REALTIME_INODE'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c: scope_hint: In function '__xfs_bunmapi'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c:5047:33: note: in expansion of macro 'XFS_IFORK_MAXEXT'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c:5047:33: note: in expansion of macro 'XFS_IFORK_MAXEXT'
# 5504|   					&del, &tmp_logflags, whichfork,
# 5505|   					flags);
# 5506|-> 			logflags |= tmp_logflags;
# 5507|   		}
# 5508|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def20]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c: scope_hint: In function 'xfs_bmse_merge'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap.c:5655:12: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
# 5653|   	 * inode.
# 5654|   	 */
# 5655|-> 	ifp->if_nextents--;
# 5656|   	*logflags |= XFS_ILOG_CORE;
# 5657|   	if (!cur) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def21]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap_btree.c: scope_hint: In function 'xfs_bmbt_get_maxrecs.part.0'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap_btree.c:313:44: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
#  311|   
#  312|   		return xfs_bmbt_maxrecs(cur->bc_mp,
#  313|-> 					ifp->if_broot_bytes, level == 0);
#  314|   	}
#  315|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def22]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/libxfs_priv.h:56: included_from: Included from here.
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap_btree.c:6: included_from: Included from here.
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap_btree.c: scope_hint: In function 'xfs_bmbt_init_cursor'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap_btree.c:560:42: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/include/xfs_arch.h:130:31: note: in definition of macro '__swab16'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap_btree.c:560:27: note: in expansion of macro 'be16_to_cpu'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/include/xfs_arch.h:130:31: note: in definition of macro '__swab16'
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_bmap_btree.c:560:27: note: in expansion of macro 'be16_to_cpu'
#  558|   	cur = xfs_btree_alloc_cursor(mp, tp, XFS_BTNUM_BMAP,
#  559|   			mp->m_bm_maxlevels[whichfork], xfs_bmbt_cur_cache);
#  560|-> 	cur->bc_nlevels = be16_to_cpu(ifp->if_broot->bb_level) + 1;
#  561|   	cur->bc_statoff = XFS_STATS_CALC_INDEX(xs_bmbt_2);
#  562|   

Error: CLANG_WARNING: [#def23]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_btree.c:16: included_from: Included from here.
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_btree.h:486:9: warning[core.NullDereference]: Access to field 'bb_numrecs' results in a dereference of a null pointer (loaded from variable 'block')
#  484|   static inline int xfs_btree_get_numrecs(const struct xfs_btree_block *block)
#  485|   {
#  486|-> 	return be16_to_cpu(block->bb_numrecs);
#  487|   }
#  488|   

Error: CLANG_WARNING: [#def24]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_defer.c:256:24: warning[unix.Malloc]: Use of memory after it is freed
#  254|   	/* Abort intent items that don't have a done item. */
#  255|   	list_for_each_entry(dfp, dop_pending, dfp_list) {
#  256|-> 		ops = defer_op_types[dfp->dfp_type];
#  257|   		trace_xfs_defer_pending_abort(tp->t_mountp, dfp);
#  258|   		if (dfp->dfp_intent && !dfp->dfp_done) {

Error: CLANG_WARNING: [#def25]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_defer.c:464:40: warning[core.uninitialized.ArraySubscript]: Array subscript is undefined
#  462|   	struct xfs_defer_pending	*dfp)
#  463|   {
#  464|-> 	const struct xfs_defer_op_type	*ops = defer_op_types[dfp->dfp_type];
#  465|   	struct xfs_btree_cur		*state = NULL;
#  466|   	struct list_head		*li, *n;

Error: CLANG_WARNING: [#def26]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_rtbitmap.c:347:8: warning[deadcode.DeadStores]: Although the value stored to 'bufp' is used in the enclosing expression, the value is never actually read from 'bufp'
#  345|   				return error;
#  346|   			}
#  347|-> 			b = bufp = bp->b_addr;
#  348|   			word = 0;
#  349|   		} else {

Error: CLANG_WARNING: [#def27]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_rtbitmap.c:392:8: warning[deadcode.DeadStores]: Although the value stored to 'bufp' is used in the enclosing expression, the value is never actually read from 'bufp'
#  390|   				return error;
#  391|   			}
#  392|-> 			b = bufp = bp->b_addr;
#  393|   			word = 0;
#  394|   		} else {

Error: CLANG_WARNING: [#def28]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_rtbitmap.c:845:8: warning[deadcode.DeadStores]: Although the value stored to 'bufp' is used in the enclosing expression, the value is never actually read from 'bufp'
#  843|   				return error;
#  844|   			}
#  845|-> 			b = bufp = bp->b_addr;
#  846|   			word = 0;
#  847|   		} else {

Error: CLANG_WARNING: [#def29]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/libxfs/xfs_rtbitmap.c:891:8: warning[deadcode.DeadStores]: Although the value stored to 'bufp' is used in the enclosing expression, the value is never actually read from 'bufp'
#  889|   				return error;
#  890|   			}
#  891|-> 			b = bufp = bp->b_addr;
#  892|   			word = 0;
#  893|   		} else {

Error: CLANG_WARNING: [#def30]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/mkfs/xfs_mkfs.c:3094:31: warning[core.DivideZero]: Division by zero
# 3092|   		}
# 3093|   		cfg->agsize /= cfg->blocksize;
# 3094|-> 		cfg->agcount = cfg->dblocks / cfg->agsize +
# 3095|   				(cfg->dblocks % cfg->agsize != 0);
# 3096|   

Error: GCC_ANALYZER_WARNING (CWE-131): [#def31]
xfsprogs-6.5.0-build/xfsprogs-6.5.0/repair/rt.c: scope_hint: In function ‘rtinit’
xfsprogs-6.5.0-build/xfsprogs-6.5.0/repair/rt.c:32:25: warning[-Wanalyzer-allocation-size]: allocated buffer size is not a multiple of the pointee's size
#   30|   	sumfile = calloc(mp->m_rsumsize, 1);
#   31|   	*/
#   32|-> 	if ((btmcompute = calloc(mp->m_sb.sb_rbmblocks *
#   33|   			mp->m_sb.sb_blocksize, 1)) == NULL)
#   34|   		do_error(

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.8.0-2.fc41
diffbase-store-results-to/tmp/tmpuqzhv6yi/xfsprogs-6.8.0-2.fc41.tar.xz
diffbase-time-created2024-07-03 18:28:35
diffbase-time-finished2024-07-03 18:33:12
diffbase-toolcsmock
diffbase-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'
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.5.0-3.fc40
store-results-to/tmp/tmp6lm12azn/xfsprogs-6.5.0-3.fc40.tar.xz
time-created2024-07-03 18:23:06
time-finished2024-07-03 18:28:09
titleFixed defects
toolcsmock
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'
tool-versioncsmock-3.5.3-1.el9