Fixed defects

List of Defects

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1]
nilfs-utils-2.2.9/lib/gc.c: scope_hint: In function 'nilfs_toss_vdescs'
nilfs-utils-2.2.9/lib/gc.c:481:24: warning[-Wanalyzer-malloc-leak]: leak of 'ss'
nilfs-utils-2.2.9/include/nilfs.h:163:1: note: in expansion of macro 'NILFS_LOCK_FNS'
nilfs-utils-2.2.9/lib/gc.c: scope_hint: In function 'nilfs_toss_vdescs'
nilfs-utils-2.2.9/lib/gc.c: scope_hint: In function 'nilfs_toss_vdescs'
#  479|   	n = nilfs_get_snapshot(nilfs, &ss);
#  480|   	if (n < 0)
#  481|-> 		return n;
#  482|   
#  483|   	last_hit = 0;

Error: GCC_ANALYZER_WARNING (CWE-457): [#def2]
nilfs-utils-2.2.9/lib/realpath.c: scope_hint: In function 'myrealpath'
nilfs-utils-2.2.9/lib/realpath.c:143:25: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'path'
#  141|   			}
#  142|   			memcpy(buf, link_path, n);
#  143|-> 			memcpy(buf + n, path, m + 1);
#  144|   			path = buf;
#  145|   #endif

Error: GCC_ANALYZER_WARNING (CWE-775): [#def3]
nilfs-utils-2.2.9/sbin/cleanerd/cleanerd.c: scope_hint: In function ‘daemonize’
nilfs-utils-2.2.9/sbin/cleanerd/cleanerd.c:764:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 0)’
#  762|   		close(1);
#  763|   		close(2);
#  764|-> 		if (open(DEVNULL, O_RDONLY) < 0)
#  765|   			return -1;
#  766|   		if (open(DEVNULL, O_WRONLY) < 0)

Error: GCC_ANALYZER_WARNING (CWE-775): [#def4]
nilfs-utils-2.2.9/sbin/cleanerd/cleanerd.c:766:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 1)’
#  764|   		if (open(DEVNULL, O_RDONLY) < 0)
#  765|   			return -1;
#  766|-> 		if (open(DEVNULL, O_WRONLY) < 0)
#  767|   			return -1;
#  768|   		if (open(DEVNULL, O_WRONLY) < 0)

Error: GCC_ANALYZER_WARNING (CWE-775): [#def5]
nilfs-utils-2.2.9/sbin/cleanerd/cleanerd.c:768:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 1)’
#  766|   		if (open(DEVNULL, O_WRONLY) < 0)
#  767|   			return -1;
#  768|-> 		if (open(DEVNULL, O_WRONLY) < 0)
#  769|   			return -1;
#  770|   	}

Error: CLANG_WARNING: [#def6]
nilfs-utils-2.2.9/sbin/mkfs/mkfs.c:721:9: warning[core.NonNullParamChecker]: Null pointer passed to 3rd parameter expecting 'nonnull'
#  719|   	}
#  720|   
#  721|-> 	while (fgets(line, LINE_BUFFER_SIZE, fp) != NULL) {
#  722|   		if (strncmp(strtok(line, " "), device, strlen(device)) == 0) {
#  723|   			fclose(fp);

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-149.us-west-2.compute.internal
diffbase-mock-configfedora-41-x86_64
diffbase-project-namenilfs-utils-2.2.11-1.fc41
diffbase-store-results-to/tmp/tmpeewajutx/nilfs-utils-2.2.11-1.fc41.tar.xz
diffbase-time-created2024-04-22 11:05:30
diffbase-time-finished2024-04-22 11:06:42
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpeewajutx/nilfs-utils-2.2.11-1.fc41.tar.xz' '--gcc-analyze' '/tmp/tmpeewajutx/nilfs-utils-2.2.11-1.fc41.src.rpm'
diffbase-tool-versioncsmock-3.5.3-1.el9
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-149.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-namenilfs-utils-2.2.9-6.fc40
store-results-to/tmp/tmpx4u3lrez/nilfs-utils-2.2.9-6.fc40.tar.xz
time-created2024-04-22 11:03:34
time-finished2024-04-22 11:05:20
titleFixed defects
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpx4u3lrez/nilfs-utils-2.2.9-6.fc40.tar.xz' '--gcc-analyze' '/tmp/tmpx4u3lrez/nilfs-utils-2.2.9-6.fc40.src.rpm'
tool-versioncsmock-3.5.3-1.el9