[lxc-devel] [lxc/master] coverity: #1425849, #1425821, #1425794, #1425779, #1425777, #1425795, #1425841

2xsec on Github lxc-bot at linuxcontainers.org
Fri Jun 8 02:31:38 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 430 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180608/3f529767/attachment.bin>
-------------- next part --------------
From 1b611563caaf884036e854ce7a0816031bd39a49 Mon Sep 17 00:00:00 2001
From: Donghwa Jeong <dh48.jeong at samsung.com>
Date: Fri, 8 Jun 2018 11:11:03 +0900
Subject: [PATCH 1/7] coverity: #1425777

Signed-off-by: Donghwa Jeong <dh48.jeong at samsung.com>
---
 src/lxc/lxccontainer.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index 04a6050f1..1ce408009 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -2777,9 +2777,6 @@ static bool has_snapshots(struct lxc_container *c)
 	if (!dir)
 		return false;
 	while ((direntp = readdir(dir))) {
-		if (!direntp)
-			break;
-
 		if (!strcmp(direntp->d_name, "."))
 			continue;
 

From 951665a30e6e7ea78b46c99f1c6e5bb4f526c770 Mon Sep 17 00:00:00 2001
From: Donghwa Jeong <dh48.jeong at samsung.com>
Date: Fri, 8 Jun 2018 11:12:52 +0900
Subject: [PATCH 2/7] coverity: #1425779

Signed-off-by: Donghwa Jeong <dh48.jeong at samsung.com>
---
 src/lxc/lxccontainer.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index 1ce408009..4a3495a30 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -4904,9 +4904,6 @@ int list_defined_containers(const char *lxcpath, char ***names, struct lxc_conta
 		*names = NULL;
 
 	while ((direntp = readdir(dir))) {
-		if (!direntp)
-			break;
-
 		/* Ignore '.', '..' and any hidden directory. */
 		if (!strncmp(direntp->d_name, ".", 1))
 			continue;

From 1e9cf480571dd85b1bc5f402bc3bc3db5bc00824 Mon Sep 17 00:00:00 2001
From: Donghwa Jeong <dh48.jeong at samsung.com>
Date: Fri, 8 Jun 2018 11:14:40 +0900
Subject: [PATCH 3/7] coverity: #1425794

Signed-off-by: Donghwa Jeong <dh48.jeong at samsung.com>
---
 src/lxc/confile.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/lxc/confile.c b/src/lxc/confile.c
index 558e32e8c..d07ada29c 100644
--- a/src/lxc/confile.c
+++ b/src/lxc/confile.c
@@ -2076,8 +2076,6 @@ static int do_includedir(const char *dirp, struct lxc_conf *lxc_conf)
 
 	while ((direntp = readdir(dir))) {
 		const char *fnam;
-		if (!direntp)
-			break;
 
 		fnam = direntp->d_name;
 		if (!strcmp(fnam, "."))

From d5329db1486d22eef9454e5b5def0a33bb5423f8 Mon Sep 17 00:00:00 2001
From: Donghwa Jeong <dh48.jeong at samsung.com>
Date: Fri, 8 Jun 2018 11:16:31 +0900
Subject: [PATCH 4/7] coverity: #1425795

Signed-off-by: Donghwa Jeong <dh48.jeong at samsung.com>
---
 src/lxc/utils.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/lxc/utils.c b/src/lxc/utils.c
index cd5edd6ab..aed6d7b96 100644
--- a/src/lxc/utils.c
+++ b/src/lxc/utils.c
@@ -2091,9 +2091,6 @@ static int lxc_get_unused_loop_dev_legacy(char *loop_name)
 		return -1;
 
 	while ((dp = readdir(dir))) {
-		if (!dp)
-			break;
-
 		if (strncmp(dp->d_name, "loop", 4) != 0)
 			continue;
 

From 4b696f90fe452353e14e80c66c0f6d268f559ff7 Mon Sep 17 00:00:00 2001
From: Donghwa Jeong <dh48.jeong at samsung.com>
Date: Fri, 8 Jun 2018 11:18:25 +0900
Subject: [PATCH 5/7] coverity: #1425821

Signed-off-by: Donghwa Jeong <dh48.jeong at samsung.com>
---
 src/lxc/lxccontainer.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index 4a3495a30..1196656b2 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -4116,9 +4116,6 @@ static int do_lxcapi_snapshot_list(struct lxc_container *c, struct lxc_snapshot
 	}
 
 	while ((direntp = readdir(dir))) {
-		if (!direntp)
-			break;
-
 		if (!strcmp(direntp->d_name, "."))
 			continue;
 

From 409842faff0e7331dafcb8a73f98576a25615bb8 Mon Sep 17 00:00:00 2001
From: Donghwa Jeong <dh48.jeong at samsung.com>
Date: Fri, 8 Jun 2018 11:20:08 +0900
Subject: [PATCH 6/7] coverity: #1425841

Signed-off-by: Donghwa Jeong <dh48.jeong at samsung.com>
---
 src/lxc/utils.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/lxc/utils.c b/src/lxc/utils.c
index aed6d7b96..12f2cd449 100644
--- a/src/lxc/utils.c
+++ b/src/lxc/utils.c
@@ -85,9 +85,6 @@ static int _recursive_rmdir(const char *dirname, dev_t pdev,
 		struct stat mystat;
 		int rc;
 
-		if (!direntp)
-			break;
-
 		if (!strcmp(direntp->d_name, ".") ||
 		    !strcmp(direntp->d_name, ".."))
 			continue;

From dcea4a23cd98ef6d911162470969522721f58324 Mon Sep 17 00:00:00 2001
From: Donghwa Jeong <dh48.jeong at samsung.com>
Date: Fri, 8 Jun 2018 11:22:18 +0900
Subject: [PATCH 7/7] coverity: #1425849

Signed-off-by: Donghwa Jeong <dh48.jeong at samsung.com>
---
 src/lxc/commands_utils.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/lxc/commands_utils.c b/src/lxc/commands_utils.c
index 3a96b42dd..426177ddc 100644
--- a/src/lxc/commands_utils.c
+++ b/src/lxc/commands_utils.c
@@ -73,9 +73,6 @@ int lxc_cmd_sock_rcv_state(int state_client_fd, int timeout)
 		return -1;
 	}
 
-	if (ret < 0)
-		return -1;
-
 	TRACE("Received state %s from state client %d",
 	      lxc_state2str(msg.value), state_client_fd);
 


More information about the lxc-devel mailing list