linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tmpfs: let lseek return ENXIO with a negative offset
@ 2018-10-25  2:22 Yufen Yu
  2018-11-01  7:13 ` William Kucharski
  2018-11-07 23:19 ` Andrew Morton
  0 siblings, 2 replies; 6+ messages in thread
From: Yufen Yu @ 2018-10-25  2:22 UTC (permalink / raw)
  To: viro, hughd; +Cc: linux-mm, linux-fsdevel, linux-unionfs

For now, the others filesystems, such as ext4, f2fs, ubifs,
all of them return ENXIO when lseek with a negative offset.
It is better to let tmpfs return ENXIO too. After that, tmpfs
can also pass generic/448.

Signed-off-by: Yufen Yu <yuyufen@huawei.com>
---
 mm/shmem.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index 0376c124..f37bf06 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2608,9 +2608,7 @@ static loff_t shmem_file_llseek(struct file *file, loff_t offset, int whence)
 	inode_lock(inode);
 	/* We're holding i_mutex so we can access i_size directly */
 
-	if (offset < 0)
-		offset = -EINVAL;
-	else if (offset >= inode->i_size)
+	if (offset < 0 || offset >= inode->i_size)
 		offset = -ENXIO;
 	else {
 		start = offset >> PAGE_SHIFT;
-- 
2.7.4

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

end of thread, other threads:[~2018-11-09  3:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-25  2:22 [PATCH] tmpfs: let lseek return ENXIO with a negative offset Yufen Yu
2018-11-01  7:13 ` William Kucharski
2018-11-07 23:19 ` Andrew Morton
2018-11-08 10:46   ` William Kucharski
2018-11-08 23:07     ` Andrew Morton
2018-11-09  3:52       ` William Kucharski

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