linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfstests: memset proper length in resvtest.c
@ 2014-03-04  5:25 Eric Sandeen
  2014-03-04 15:36 ` Brian Foster
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Sandeen @ 2014-03-04  5:25 UTC (permalink / raw)
  To: xfs-oss

sizeof(pointer) is not very relevant; sizeof(*pointer)
is a bit more so.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

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));
 
 	unlink(filename);
 	writefd = open(filename, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfstests: memset proper length in resvtest.c
  2014-03-04  5:25 [PATCH] xfstests: memset proper length in resvtest.c Eric Sandeen
@ 2014-03-04 15:36 ` Brian Foster
  2014-03-04 16:49   ` Eric Sandeen
  0 siblings, 1 reply; 3+ messages in thread
From: Brian Foster @ 2014-03-04 15:36 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs-oss

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@redhat.com>
> ---
> 
> 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.

Brian

>  	unlink(filename);
>  	writefd = open(filename, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfstests: memset proper length in resvtest.c
  2014-03-04 15:36 ` Brian Foster
@ 2014-03-04 16:49   ` Eric Sandeen
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Sandeen @ 2014-03-04 16:49 UTC (permalink / raw)
  To: Brian Foster, Eric Sandeen; +Cc: xfs-oss

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@redhat.com>
>> ---
>>
>> 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


_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-04 16:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-04  5:25 [PATCH] xfstests: memset proper length in resvtest.c Eric Sandeen
2014-03-04 15:36 ` Brian Foster
2014-03-04 16:49   ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).