[Ocfs2-tools-devel] [PATCH] fix compiling error in mount.ocfs2.c

Joel Becker Joel.Becker at oracle.com
Fri Apr 16 13:09:53 PDT 2010


On Sun, Apr 11, 2010 at 04:14:19PM +0800, Coly Li wrote:
> >> diff --git a/mount.ocfs2/mount.ocfs2.c b/mount.ocfs2/mount.ocfs2.c
> >> index f820a30..36e74ac 100644
> >> --- a/mount.ocfs2/mount.ocfs2.c
> >> +++ b/mount.ocfs2/mount.ocfs2.c
> >> @@ -261,7 +261,7 @@ int main(int argc, char **argv)
> >>  	char *extra = NULL;
> >>  	int dev_ro = 0;
> >>  	char *hbstr = NULL;
> >> -	char stackstr[strlen(OCFS2_CLUSTER_STACK_ARG) + OCFS2_STACK_LABEL_LEN + 1] = "";
> >> +	char stackstr[sizeof(OCFS2_CLUSTER_STACK_ARG) + OCFS2_STACK_LABEL_LEN] = "";
> >>  	ocfs2_filesys *fs = NULL;
> >>  	struct o2cb_cluster_desc cluster;
> >>  	struct o2cb_region_desc desc;
> > 
> > 	NAK, this is broken.  Once you actually fill the thing, there
> > isn't enough room.
> > 
> 
> sizeof(OCFS2_CLUSTER_STACK_ARG) is equal to "1 + strlen(OCFS2_CLUSTER_STACK_ARG)", size of stackstr is same.

	Oh, I see what you did.  I guess it's ok.

Joel

-- 

Life's Little Instruction Book #80

	"Slow dance"

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127



More information about the Ocfs2-tools-devel mailing list