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

Sunil Mushran Sunil.Mushran at oracle.com
Fri May 25 10:00:28 PDT 2007


sob

tao.ma wrote:
> 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/>
> ------------------------------------------------------------------------
>
> 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) {
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> Ocfs2-tools-devel mailing list
> Ocfs2-tools-devel at oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-tools-devel




More information about the Ocfs2-tools-devel mailing list