public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix XFSQA 144
@ 2008-06-14 19:22 Christoph Hellwig
  2008-06-18  7:19 ` Donald Douwsma
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2008-06-14 19:22 UTC (permalink / raw)
  To: xfs

Two really dumb bugs:

 - "foo & 0x3FFFFFFFFFFFF" doesn't cap at 1TB, but rather at more than
   two magnitudes larger than that.  That gets us EFBIG with typical
   32bit XFS setups.
 - the command array can easily overflow and thus let the test fail


Signed-off-by: Christoph Hellwig <hch@lst.de>


Index: xfstests/dmapi/src/suite2/src/test_fileattr.c
===================================================================
RCS file: /cvs/xfs-cmds/xfstests/dmapi/src/suite2/src/test_fileattr.c,v
retrieving revision 1.12
diff -u -p -r1.12 test_fileattr.c
--- xfstests/dmapi/src/suite2/src/test_fileattr.c	21 Sep 2007 04:15:06 -0000	1.12
+++ xfstests/dmapi/src/suite2/src/test_fileattr.c	14 Jun 2008 19:12:43 -0000
@@ -160,7 +160,7 @@ main(
 	char		*ls_path;
 	char		*pathname;
 	char            test_file[100];
-	char            command[100];
+	char            command[200];
 	int		num_files=50;
 	dm_stat_t	*stat_arr;
 	dm_stat_t	dmstat;
@@ -244,7 +244,7 @@ main(
 	  stat_arr[i].dt_uid=(uid_t)(rand()+rand()*0x10000);
 	  stat_arr[i].dt_gid=(gid_t)(rand()+rand()*0x10000);
 	  stat_arr[i].dt_mode=(mode_t)((rand()%4096)+32768);
-          stat_arr[i].dt_size=((dm_off_t)(rand()+rand()*0x10000)) & 0x3FFFFFFFFFFFF; /* 1 TB max */
+          stat_arr[i].dt_size=((dm_off_t)(rand()+rand()*0x10000)) & 0x1FFFFFFFFFFULL; /* 1 TB max */
 	}	
 
 	/*-----------------------------------------------------*\

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

* Re: [PATCH] fix XFSQA 144
  2008-06-14 19:22 [PATCH] fix XFSQA 144 Christoph Hellwig
@ 2008-06-18  7:19 ` Donald Douwsma
  0 siblings, 0 replies; 2+ messages in thread
From: Donald Douwsma @ 2008-06-18  7:19 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

Christoph Hellwig wrote:
> Two really dumb bugs:
> 
>  - "foo & 0x3FFFFFFFFFFFF" doesn't cap at 1TB, but rather at more than
>    two magnitudes larger than that.  That gets us EFBIG with typical
>    32bit XFS setups.
>  - the command array can easily overflow and thus let the test fail
> 
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks good, thanks for the fix.
Checking it in now.

> 
> 
> Index: xfstests/dmapi/src/suite2/src/test_fileattr.c
> ===================================================================
> RCS file: /cvs/xfs-cmds/xfstests/dmapi/src/suite2/src/test_fileattr.c,v
> retrieving revision 1.12
> diff -u -p -r1.12 test_fileattr.c
> --- xfstests/dmapi/src/suite2/src/test_fileattr.c	21 Sep 2007 04:15:06 -0000	1.12
> +++ xfstests/dmapi/src/suite2/src/test_fileattr.c	14 Jun 2008 19:12:43 -0000
> @@ -160,7 +160,7 @@ main(
>  	char		*ls_path;
>  	char		*pathname;
>  	char            test_file[100];
> -	char            command[100];
> +	char            command[200];
>  	int		num_files=50;
>  	dm_stat_t	*stat_arr;
>  	dm_stat_t	dmstat;
> @@ -244,7 +244,7 @@ main(
>  	  stat_arr[i].dt_uid=(uid_t)(rand()+rand()*0x10000);
>  	  stat_arr[i].dt_gid=(gid_t)(rand()+rand()*0x10000);
>  	  stat_arr[i].dt_mode=(mode_t)((rand()%4096)+32768);
> -          stat_arr[i].dt_size=((dm_off_t)(rand()+rand()*0x10000)) & 0x3FFFFFFFFFFFF; /* 1 TB max */
> +          stat_arr[i].dt_size=((dm_off_t)(rand()+rand()*0x10000)) & 0x1FFFFFFFFFFULL; /* 1 TB max */
>  	}	
>  
>  	/*-----------------------------------------------------*\
> 

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

end of thread, other threads:[~2008-06-18  7:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-14 19:22 [PATCH] fix XFSQA 144 Christoph Hellwig
2008-06-18  7:19 ` Donald Douwsma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox