xfs
[Top] [All Lists]

Re: [PATCH] xfstests: memset proper length in resvtest.c

To: Brian Foster <bfoster@xxxxxxxxxx>, Eric Sandeen <sandeen@xxxxxxxxxx>
Subject: Re: [PATCH] xfstests: memset proper length in resvtest.c
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Tue, 04 Mar 2014 10:49:29 -0600
Cc: xfs-oss <xfs@xxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20140304153655.GC51235@xxxxxxxxxxxxxxx>
References: <531563D8.2070007@xxxxxxxxxx> <20140304153655.GC51235@xxxxxxxxxxxxxxx>
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.3.0
On 3/4/14, 9:36 AM, Brian Foster wrote:
> On Mon, Mar 03, 2014 at 11:25:44PM -0600, Eric Sandeen wrote:
>> sizeof(pointer) is not very relevant; sizeof(*pointer)
>> is a bit more so.
>>
>> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
>> ---
>>
>> diff --git a/src/resvtest.c b/src/resvtest.c
>> index 037d9ea..a07f503 100644
>> --- a/src/resvtest.c
>> +++ b/src/resvtest.c
>> @@ -73,7 +73,7 @@ main(int argc, char **argv)
>>              perror("open");
>>              exit(1);
>>      }
>> -    memset(writebuffer, 'A', sizeof(writebuffer));
>> +    memset(writebuffer, 'A', sizeof(*writebuffer));
>>
> 
> It's not clear to me how much this is intending to write/read. If the
> entire buffer, we should probably use the buffer size.
> sizeof(*writebuffer) is a single byte, no?
> 
> Also, there are other instances of the same thing throughout this file.
> I think they need to be consistent, in any event, for the test to work.

yeah, sorry, I was in a bit too much of a rush; just disregard this
for now I guess.  too-quick reaction to a gcc compile warning.

-Eric


<Prev in Thread] Current Thread [Next in Thread>