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

Coly Li coly.li at suse.de
Sun Apr 11 01:14:19 PDT 2010



On 04/11/2010 03:46 PM, Joel Becker Wrote:
> On Sun, Apr 11, 2010 at 03:50:47PM +0800, Coly Li wrote:
>> This patch fixes a compiling error in mount.ocfs2.
>>
>> Signed-off-by: Coly Li <coly.li at suse.de>
>> ---
>>  mount.ocfs2/mount.ocfs2.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> 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.

CMIIW.

-- 
Coly Li
SuSE Labs



More information about the Ocfs2-tools-devel mailing list