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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Brian

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

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




[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux