[Ocfs2-tools-devel] [PATCH] debugfs.ocfs2: fix slotmap segment fault when the user don't open the device

tao.ma tao.ma at oracle.com
Thu May 24 19:10:14 PDT 2007


The command "slotmap" in debugfs.ocfs2 fails to check whether the device 
is open before using it and causes segment fault. So fix it.
Thanks Haobo Zhou for pointing it out.
<http://www.oracle.com/cdc/>
-------------- next part --------------
Index: debugfs.ocfs2/commands.c
===================================================================
--- debugfs.ocfs2/commands.c	(revision 1354)
+++ debugfs.ocfs2/commands.c	(working copy)
@@ -1176,11 +1176,12 @@ static void do_slotmap (char **args)
 	FILE *out;
 	errcode_t ret;
 	char *buf = NULL;
-	uint32_t len = gbls.fs->fs_blocksize;
+	uint32_t len;
 
 	if (check_device_open())
 		return ;
 
+	len = gbls.fs->fs_blocksize;
 	/* read in the first block of the slot_map file */
 	ret = read_whole_file(gbls.fs, gbls.slotmap_blkno, &buf, &len);
 	if (ret) {


More information about the Ocfs2-tools-devel mailing list