linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev PATCH] mkfs.f2fs: fix a segfault when setting more than 7 devices
@ 2017-01-22  9:16 Kinglong Mee
  0 siblings, 0 replies; only message in thread
From: Kinglong Mee @ 2017-01-22  9:16 UTC (permalink / raw)
  To: Jaegeuk Kim, linux-f2fs-devel

[root@localhost f2fs-tools]# mkfs.f2fs -c /dev/sdb1 -c /dev/sdb1 -c /dev/sdb1 -c /dev/sdb1 -c /dev/sdb1 -c /dev/sdb1 -c /dev/sdb1 -c /dev/sdb1 -c /dev/sdb1 /dev/sdb1 

kernel: mkfs.f2fs[9047]: segfault at 2b78a60f ip 0000000000401356 sp 00007fffde05c9c0 error 6 in mkfs.f2fs[400000+5000]

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 mkfs/f2fs_format_main.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/mkfs/f2fs_format_main.c b/mkfs/f2fs_format_main.c
index 70ed77a..db1dc94 100644
--- a/mkfs/f2fs_format_main.c
+++ b/mkfs/f2fs_format_main.c
@@ -28,7 +28,7 @@ static void mkfs_usage()
 	MSG(0, "\nUsage: mkfs.f2fs [options] device [sectors]\n");
 	MSG(0, "[options]:\n");
 	MSG(0, "  -a heap-based allocation [default:1]\n");
-	MSG(0, "  -c [device path]\n");
+	MSG(0, "  -c [device path] up to 7 devices excepts meta device\n");
 	MSG(0, "  -d debug level [default:0]\n");
 	MSG(0, "  -e [extension list] e.g. \"mp3,gif,mov\"\n");
 	MSG(0, "  -l label\n");
@@ -84,6 +84,11 @@ static void f2fs_parse_options(int argc, char *argv[])
 			c.heap = atoi(optarg);
 			break;
 		case 'c':
+			if (c.ndevs >= MAX_DEVICES) {
+				MSG(0, "Error: Too many devices\n");
+				mkfs_usage();
+			}
+
 			if (strlen(optarg) > MAX_PATH_LEN) {
 				MSG(0, "Error: device path should be less than "
 					"%d characters\n", MAX_PATH_LEN);
@@ -135,12 +140,8 @@ static void f2fs_parse_options(int argc, char *argv[])
 		mkfs_usage();
 	}
 
-	/* [0] : META, [1 to MAX_DEVICES + 1] : NODE/DATA */
+	/* [0] : META, [1 to MAX_DEVICES - 1] : NODE/DATA */
 	c.devices[0].path = strdup(argv[optind]);
-	if (c.ndevs > MAX_DEVICES) {
-		MSG(0, "\tError: Too many devices\n");
-		mkfs_usage();
-	}
 
 	if ((optind + 1) < argc) {
 		if (c.ndevs > 1) {
-- 
2.9.3


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-22  9:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-22  9:16 [f2fs-dev PATCH] mkfs.f2fs: fix a segfault when setting more than 7 devices Kinglong Mee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).