Skip to contentSkip to conversation

Covscan Scan: Wrong Check of Return Value

PATCH In review Steve Dickson 1 participant 4 messages Jan 4, 2023 – Jan 11, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Covscan Scan: Wrong Check of Return Value

---
 support/export/client.c | 3 +++
 1 file changed, 3 insertions(+)
support/export/client.c +3 -0
index ea4f89d..79164fe 100644
@@ -699,6 +699,9 @@ check_netgroup(const nfs_client *clp, const struct addrinfo *ai)
 
 	/* check whether the IP itself is in the netgroup */
 	ip = calloc(INET6_ADDRSTRLEN, 1);
+	if (ip == NULL)
+		goto out;
+
 	if (inet_ntop(ai->ai_family, &(((struct sockaddr_in *)ai->ai_addr)->sin_addr), ip, INET6_ADDRSTRLEN) == ip) {
 		if (innetgr(netgroup, ip, NULL, NULL)) {
 			free(hname);
Signature · 1 line
2.38.1
#1 lore raw

PATCH 2/2 Covscan Scan: Fixed a couple CLANG_WARNINGs

---
 tools/nfsrahead/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/nfsrahead/main.c +1 -1
index c83c6f7..8a11cf1 100644
@@ -167,7 +167,7 @@ int main(int argc, char **argv)
 		if ((ret = get_device_info(argv[optind], &device)) == 0)
 			break;
 
-	if (ret != 0) {
+	if (ret != 0 || device.fstype == NULL) {
 		xlog(D_GENERAL, "unable to find device %s\n", argv[optind]);
 		goto out;
 	}
Signature · 1 line
2.38.1
#2 lore raw

Re: [PATCH 2/2] Covscan Scan: Fixed a couple CLANG_WARNINGs

Quoted 2 lines · Steve Dickson

Committed... (tag: nfs-utils-2-6-3-rc6)

steved.

Quoted 17 lines
---
  tools/nfsrahead/main.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tools/nfsrahead/main.c +1 -1
index c83c6f7..8a11cf1 100644
@@ -167,7 +167,7 @@ int main(int argc, char **argv)
  		if ((ret = get_device_info(argv[optind], &device)) == 0)
  			break;
 
-	if (ret != 0) {
+	if (ret != 0 || device.fstype == NULL) {
  		xlog(D_GENERAL, "unable to find device %s\n", argv[optind]);
  		goto out;
  	}
#3 lore raw
In reply to Steve Dickson
Quoted 2 lines · Steve Dickson

Committed... (tag: nfs-utils-2-6-3-rc6)

steved.

Quoted 18 lines
---
  support/export/client.c | 3 +++
  1 file changed, 3 insertions(+)
support/export/client.c +3 -0
index ea4f89d..79164fe 100644
@@ -699,6 +699,9 @@ check_netgroup(const nfs_client *clp, const struct addrinfo *ai)
 
  	/* check whether the IP itself is in the netgroup */
  	ip = calloc(INET6_ADDRSTRLEN, 1);
+	if (ip == NULL)
+		goto out;
+
  	if (inet_ntop(ai->ai_family, &(((struct sockaddr_in *)ai->ai_addr)->sin_addr), ip, INET6_ADDRSTRLEN) == ip) {
  		if (innetgr(netgroup, ip, NULL, NULL)) {
  			free(hname);