Btrfs-progs: fix segmentation fault of "btrfs check"
diff mbox

Message ID 201302270231.AA00022@FM-323941448.jp.fujitsu.com
State Under Review, archived
Headers show

Commit Message

Tsutomu Itoh Feb. 27, 2013, 2:31 a.m. UTC
Segmentation fault occurred in the following command.

 # btrfs check /dev/sdc7
 No valid Btrfs found on /dev/sdc7
 Segmentation fault (core dumped)

Fix it.

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
---
 cmds-check.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/cmds-check.c b/cmds-check.c
index d63e945..5d2e9ed 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -3610,12 +3610,12 @@  int cmd_check(int argc, char **argv)
 	}
 
 	info = open_ctree_fs_info(argv[optind], bytenr, rw, 1);
-	uuid_unparse(info->super_copy.fsid, uuidbuf);
-	printf("Checking filesystem on %s\nUUID: %s\n", argv[optind], uuidbuf);
-
 	if (info == NULL)
 		return 1;
 
+	uuid_unparse(info->super_copy.fsid, uuidbuf);
+	printf("Checking filesystem on %s\nUUID: %s\n", argv[optind], uuidbuf);
+
 	if (!extent_buffer_uptodate(info->tree_root->node) ||
 	    !extent_buffer_uptodate(info->dev_root->node) ||
 	    !extent_buffer_uptodate(info->extent_root->node) ||