fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Test seeks from LLONG_MIN
@ 2021-07-06 20:14 Matthew Wilcox
  2021-07-07  0:24 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Wilcox @ 2021-07-06 20:14 UTC (permalink / raw)
  To: Eryu Guan, fstests, Darrick J. Wong; +Cc: Zhen Lei

We don't currently test seeking from LLONG_MIN, which apparently can
produce an UBSAN warning, although I've been unable to reproduce that.
In any case, it's a good corner case to test and straightforward to add.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

diff --git a/src/seek_sanity_test.c b/src/seek_sanity_test.c
index cb036f7b..76587b7f 100644
--- a/src/seek_sanity_test.c
+++ b/src/seek_sanity_test.c
@@ -395,8 +395,12 @@ static int test18(int fd, int testnum)
 	int ret = 0;
 
 	/* file size doesn't matter in this test, set to 0 */
+	ftruncate(fd, 0);
+
 	ret += do_lseek(testnum, 1, fd, 0, SEEK_HOLE, -1, -1);
 	ret += do_lseek(testnum, 2, fd, 0, SEEK_DATA, -1, -1);
+	ret += do_lseek(testnum, 3, fd, 0, SEEK_HOLE, LLONG_MIN, -1);
+	ret += do_lseek(testnum, 4, fd, 0, SEEK_DATA, LLONG_MIN, -1);
 
 	return ret;
 }


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

* Re: [PATCH] Test seeks from LLONG_MIN
  2021-07-06 20:14 [PATCH] Test seeks from LLONG_MIN Matthew Wilcox
@ 2021-07-07  0:24 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2021-07-07  0:24 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: Eryu Guan, fstests, Zhen Lei

On Tue, Jul 06, 2021 at 09:14:46PM +0100, Matthew Wilcox wrote:
> We don't currently test seeking from LLONG_MIN, which apparently can
> produce an UBSAN warning, although I've been unable to reproduce that.
> In any case, it's a good corner case to test and straightforward to add.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Seems reasonable to me...
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> 
> diff --git a/src/seek_sanity_test.c b/src/seek_sanity_test.c
> index cb036f7b..76587b7f 100644
> --- a/src/seek_sanity_test.c
> +++ b/src/seek_sanity_test.c
> @@ -395,8 +395,12 @@ static int test18(int fd, int testnum)
>  	int ret = 0;
>  
>  	/* file size doesn't matter in this test, set to 0 */
> +	ftruncate(fd, 0);
> +
>  	ret += do_lseek(testnum, 1, fd, 0, SEEK_HOLE, -1, -1);
>  	ret += do_lseek(testnum, 2, fd, 0, SEEK_DATA, -1, -1);
> +	ret += do_lseek(testnum, 3, fd, 0, SEEK_HOLE, LLONG_MIN, -1);
> +	ret += do_lseek(testnum, 4, fd, 0, SEEK_DATA, LLONG_MIN, -1);
>  
>  	return ret;
>  }
> 

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

end of thread, other threads:[~2021-07-07  0:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06 20:14 [PATCH] Test seeks from LLONG_MIN Matthew Wilcox
2021-07-07  0:24 ` Darrick J. Wong

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).