Blame SOURCES/e2fsprogs-1.42.9-14-misc-fix-Coverity-bugs.patch

0ef434
From df9c49cb287a9cd79ee2589ddfa3db0bc1a9d97b Mon Sep 17 00:00:00 2001
0ef434
From: "Darrick J. Wong" <darrick.wong@oracle.com>
0ef434
Date: Sat, 16 May 2015 18:32:33 -0400
0ef434
Subject: [PATCH 12/16] misc: fix Coverity bugs
0ef434
0ef434
commit 63cd76d6ac3bb7f90c583f240fc75e657610f2ea
0ef434
0ef434
Fix Coverity bugs 1297093, 1297096, 1297489, 1297491, 1297493,
0ef434
1297506, 1297507, 1297514, 1297516, and 1297517.
0ef434
0ef434
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
0ef434
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
0ef434
---
0ef434
 debugfs/util.c    | 2 +-
0ef434
 lib/e2p/feature.c | 4 ++--
0ef434
 lib/e2p/mntopts.c | 2 +-
0ef434
 misc/e4defrag.c   | 4 +++-
0ef434
 misc/logsave.c    | 2 +-
0ef434
 5 files changed, 8 insertions(+), 6 deletions(-)
0ef434
0ef434
diff --git a/debugfs/util.c b/debugfs/util.c
0ef434
index aafbc567..b355e5cd 100644
0ef434
--- a/debugfs/util.c
0ef434
+++ b/debugfs/util.c
0ef434
@@ -373,7 +373,7 @@ int common_block_args_process(int argc, char *argv[],
0ef434
 		return 1;
0ef434
 	if (*block == 0) {
0ef434
 		com_err(argv[0], 0, "Invalid block number 0");
0ef434
-		err = 1;
0ef434
+		return 1;
0ef434
 	}
0ef434
 
0ef434
 	if (argc > 2) {
0ef434
diff --git a/lib/e2p/feature.c b/lib/e2p/feature.c
0ef434
index 96912638..d4f1bf1a 100644
0ef434
--- a/lib/e2p/feature.c
0ef434
+++ b/lib/e2p/feature.c
0ef434
@@ -177,7 +177,7 @@ int e2p_string2feature(char *string, int *compat_type, unsigned int *mask)
0ef434
 	if (string[9] == 0)
0ef434
 		return 1;
0ef434
 	num = strtol(string+9, &eptr, 10);
0ef434
-	if (num > 32 || num < 0)
0ef434
+	if (num > 31 || num < 0)
0ef434
 		return 1;
0ef434
 	if (*eptr)
0ef434
 		return 1;
0ef434
@@ -251,7 +251,7 @@ int e2p_jrnl_string2feature(char *string, int *compat_type, unsigned int *mask)
0ef434
 	if (string[9] == 0)
0ef434
 		return 1;
0ef434
 	num = strtol(string+9, &eptr, 10);
0ef434
-	if (num > 32 || num < 0)
0ef434
+	if (num > 31 || num < 0)
0ef434
 		return 1;
0ef434
 	if (*eptr)
0ef434
 		return 1;
0ef434
diff --git a/lib/e2p/mntopts.c b/lib/e2p/mntopts.c
0ef434
index d56cc527..ff2e5de9 100644
0ef434
--- a/lib/e2p/mntopts.c
0ef434
+++ b/lib/e2p/mntopts.c
0ef434
@@ -72,7 +72,7 @@ int e2p_string2mntopt(char *string, unsigned int *mask)
0ef434
 	if (string[8] == 0)
0ef434
 		return 1;
0ef434
 	num = strtol(string+8, &eptr, 10);
0ef434
-	if (num > 32 || num < 0)
0ef434
+	if (num > 31 || num < 0)
0ef434
 		return 1;
0ef434
 	if (*eptr)
0ef434
 		return 1;
0ef434
diff --git a/misc/e4defrag.c b/misc/e4defrag.c
0ef434
index 2c2034cf..99baeb7b 100644
0ef434
--- a/misc/e4defrag.c
0ef434
+++ b/misc/e4defrag.c
0ef434
@@ -440,8 +440,10 @@ static int page_in_core(int fd, struct move_extent defrag_data,
0ef434
 	*page_num = 0;
0ef434
 	*page_num = (length + pagesize - 1) / pagesize;
0ef434
 	*vec = (unsigned char *)calloc(*page_num, 1);
0ef434
-	if (*vec == NULL)
0ef434
+	if (*vec == NULL) {
0ef434
+		munmap(page, length);
0ef434
 		return -1;
0ef434
+	}
0ef434
 
0ef434
 	/* Get information on whether pages are in core */
0ef434
 	if (mincore(page, (size_t)length, *vec) == -1 ||
0ef434
diff --git a/misc/logsave.c b/misc/logsave.c
0ef434
index 8612edfb..cd6037dd 100644
0ef434
--- a/misc/logsave.c
0ef434
+++ b/misc/logsave.c
0ef434
@@ -219,7 +219,7 @@ static int run_program(char **argv)
0ef434
 			sprintf(buffer, "died with signal %d\n",
0ef434
 				WTERMSIG(status));
0ef434
 			send_output(buffer, 0, SEND_BOTH);
0ef434
-			rc = 1;
0ef434
+			return 1;
0ef434
 		}
0ef434
 		rc = 0;
0ef434
 	}
0ef434
-- 
0ef434
2.20.1
0ef434