From: Theodore Ts'o <tytso@mit.edu>
Subject: e2freefrag: require that the chunksize must be greater than 0

"e2freefrag -c 0" doesn't make much sense, so abort with an error
message if the user specifies a zero chunksize.

Addresses-Coverity-Bug: 1633767
Origin: upstream, https://github.com/tytso/e2fsprogs/commit/3e059df08de94abde1ddd82008d0658584a35e5e
---
 misc/e2freefrag.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/misc/e2freefrag.c b/misc/e2freefrag.c
index 63a3d4351..c66e8f22f 100644
--- a/misc/e2freefrag.c
+++ b/misc/e2freefrag.c
@@ -405,7 +405,7 @@ int main(int argc, char *argv[])
 		switch (c) {
 		case 'c':
 			chunk_info.chunkbytes = strtoull(optarg, &end, 0);
-			if (*end != '\0') {
+			if (*end != '\0' || chunk_info.chunkbytes == 0) {
 				fprintf(stderr, "%s: bad chunk size '%s'\n",
 					progname, optarg);
 				usage(progname);
-- 
2.47.2

