public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Eryu Guan <guaneryu@gmail.com>,
	fstests@vger.kernel.org, "Darrick J. Wong" <djwong@kernel.org>
Cc: Zhen Lei <thunder.leizhen@huawei.com>
Subject: [PATCH] Test seeks from LLONG_MIN
Date: Tue, 6 Jul 2021 21:14:46 +0100	[thread overview]
Message-ID: <YOS5trAuJN+ho+Is@casper.infradead.org> (raw)

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;
 }


             reply	other threads:[~2021-07-06 20:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-06 20:14 Matthew Wilcox [this message]
2021-07-07  0:24 ` [PATCH] Test seeks from LLONG_MIN Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YOS5trAuJN+ho+Is@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=guaneryu@gmail.com \
    --cc=thunder.leizhen@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox