Fixed defects

List of Defects

Error: COMPILER_WARNING (CWE-681): [#def1]
xfsprogs-6.5.0/db/hash.c: scope_hint: In function ‘hash_f’
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/include/libxfs.h:59: included_from: Included from here.
xfsprogs-6.5.0/db/hash.c:7: included_from: Included from here.
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/db/hash.c: scope_hint: In function ‘collide_dirents’
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/include/platform_defs.h:12: included_from: Included from here.
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/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/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/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/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/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/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/db/hash.c: scope_hint: In function ‘collide_xattrs’
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/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/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/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/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/db/hash.c: scope_hint: In function ‘hashcoll_f’
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/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/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/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/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/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/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/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/libxfs/xfs_bmap.c:6: included_from: Included from here.
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: CLANG_WARNING: [#def16]
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: [#def17]
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: [#def18]
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: [#def19]
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: [#def20]
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 {

Scan Properties

analyzer-version-clang18.1.3
analyzer-version-cppcheck2.13.0
analyzer-version-gcc14.0.1
analyzer-version-gcc-analyzer14.0.1
analyzer-version-shellcheck0.10.0
diffbase-analyzer-version-clang18.1.3
diffbase-analyzer-version-cppcheck2.13.0
diffbase-analyzer-version-gcc14.0.1
diffbase-analyzer-version-gcc-analyzer14.0.1
diffbase-analyzer-version-shellcheck0.10.0
diffbase-enabled-pluginsclang, cppcheck, gcc, shellcheck
diffbase-exit-code0
diffbase-hostip-172-16-1-240.us-west-2.compute.internal
diffbase-mock-configfedora-41-x86_64
diffbase-project-namexfsprogs-6.7.0-1.fc41
diffbase-store-results-to/tmp/tmp3bob_r61/xfsprogs-6.7.0-1.fc41.tar.xz
diffbase-time-created2024-04-22 11:25:41
diffbase-time-finished2024-04-22 11:30:15
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmp3bob_r61/xfsprogs-6.7.0-1.fc41.tar.xz' '--gcc-analyze' '/tmp/tmp3bob_r61/xfsprogs-6.7.0-1.fc41.src.rpm'
diffbase-tool-versioncsmock-3.5.3-1.el9
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-240.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-namexfsprogs-6.5.0-3.fc40
store-results-to/tmp/tmp70o3a5o2/xfsprogs-6.5.0-3.fc40.tar.xz
time-created2024-04-22 11:20:18
time-finished2024-04-22 11:25:24
titleFixed defects
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmp70o3a5o2/xfsprogs-6.5.0-3.fc40.tar.xz' '--gcc-analyze' '/tmp/tmp70o3a5o2/xfsprogs-6.5.0-3.fc40.src.rpm'
tool-versioncsmock-3.5.3-1.el9