[lxc-devel] [lxc/master] Coverity

2xsec on Github lxc-bot at linuxcontainers.org
Thu Jun 7 02:16:39 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 350 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180607/c82bb6da/attachment.bin>
-------------- next part --------------
From f2d6d60a183e551a6c3e4cf2d7f11455a9b17026 Mon Sep 17 00:00:00 2001
From: Donghwa Jeong <dh48.jeong at samsung.com>
Date: Thu, 7 Jun 2018 11:09:25 +0900
Subject: [PATCH 1/2] coverity: remove deadcode

Signed-off-by: Donghwa Jeong <dh48.jeong at samsung.com>
---
 src/lxc/confile.c      | 2 --
 src/lxc/lxccontainer.c | 9 ---------
 src/lxc/pam/pam_cgfs.c | 3 ---
 src/lxc/utils.c        | 6 ------
 4 files changed, 20 deletions(-)
 mode change 100644 => 100755 src/lxc/confile.c
 mode change 100644 => 100755 src/lxc/lxccontainer.c
 mode change 100644 => 100755 src/lxc/pam/pam_cgfs.c
 mode change 100644 => 100755 src/lxc/utils.c

diff --git a/src/lxc/confile.c b/src/lxc/confile.c
old mode 100644
new mode 100755
index 558e32e8c..d07ada29c
--- 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, "."))
diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
old mode 100644
new mode 100755
index 04a6050f1..1196656b2
--- 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;
 
@@ -4119,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;
 
@@ -4907,9 +4901,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;
diff --git a/src/lxc/pam/pam_cgfs.c b/src/lxc/pam/pam_cgfs.c
old mode 100644
new mode 100755
index 5c272b0e8..d5196f8a0
--- a/src/lxc/pam/pam_cgfs.c
+++ b/src/lxc/pam/pam_cgfs.c
@@ -525,9 +525,6 @@ static int recursive_rmdir(char *dirname)
 		struct stat st;
 		char *pathname;
 
-		if (!direntp)
-			break;
-
 		if (!strcmp(direntp->d_name, ".") ||
 		    !strcmp(direntp->d_name, ".."))
 			continue;
diff --git a/src/lxc/utils.c b/src/lxc/utils.c
old mode 100644
new mode 100755
index cd5edd6ab..12f2cd449
--- 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;
@@ -2091,9 +2088,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 886f46b926a3c08ba15d422f8e9edf11d23c6765 Mon Sep 17 00:00:00 2001
From: Donghwa Jeong <dh48.jeong at samsung.com>
Date: Thu, 7 Jun 2018 11:13:07 +0900
Subject: [PATCH 2/2] fix file modes

Signed-off-by: Donghwa Jeong <dh48.jeong at samsung.com>
---
 src/lxc/confile.c      | 0
 src/lxc/lxccontainer.c | 0
 src/lxc/pam/pam_cgfs.c | 0
 src/lxc/utils.c        | 0
 4 files changed, 0 insertions(+), 0 deletions(-)
 mode change 100755 => 100644 src/lxc/confile.c
 mode change 100755 => 100644 src/lxc/lxccontainer.c
 mode change 100755 => 100644 src/lxc/pam/pam_cgfs.c
 mode change 100755 => 100644 src/lxc/utils.c

diff --git a/src/lxc/confile.c b/src/lxc/confile.c
old mode 100755
new mode 100644
diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
old mode 100755
new mode 100644
diff --git a/src/lxc/pam/pam_cgfs.c b/src/lxc/pam/pam_cgfs.c
old mode 100755
new mode 100644
diff --git a/src/lxc/utils.c b/src/lxc/utils.c
old mode 100755
new mode 100644


More information about the lxc-devel mailing list