Linux-Fsdevel Archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs: allow no_seek_end_llseek to actually seek
@ 2016-02-05 16:08 Wouter van Kesteren
  2016-02-16 20:35 ` [PATCH] " Andreas Dilger
  0 siblings, 1 reply; 2+ messages in thread
From: Wouter van Kesteren @ 2016-02-05 16:08 UTC (permalink / raw
  To: linux-fsdevel

'~0ULL' is a 'unsigned long long' that when converted to a loff_t,
which is signed, gets turned into -1. later in vfs_setpos we have
'if (offset > maxsize)', which makes it always return EINVAL.
---
 fs/read_write.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/read_write.c b/fs/read_write.c
index 324ec27..0c8782a 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -17,6 +17,7 @@
 #include <linux/splice.h>
 #include <linux/compat.h>
 #include <linux/mount.h>
+#include <linux/fs.h>
 #include "internal.h"
 
 #include <asm/uaccess.h>
@@ -183,7 +184,7 @@ loff_t no_seek_end_llseek(struct file *file, loff_t offset, int whence)
 	switch (whence) {
 	case SEEK_SET: case SEEK_CUR:
 		return generic_file_llseek_size(file, offset, whence,
-						~0ULL, 0);
+						OFFSET_MAX, 0);
 	default:
 		return -EINVAL;
 	}
-- 
2.7.0


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

* Re: [PATCH] allow no_seek_end_llseek to actually seek
  2016-02-05 16:08 [PATCH] fs: allow no_seek_end_llseek to actually seek Wouter van Kesteren
@ 2016-02-16 20:35 ` Andreas Dilger
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Dilger @ 2016-02-16 20:35 UTC (permalink / raw
  To: Wouter van Kesteren, Alexander Viro; +Cc: linux-fsdevel

On Feb 5, 2016, at 9:08 AM, Wouter van Kesteren <woutershep@gmail.com> wrote:
> 
> '~0ULL' is a 'unsigned long long' that when converted to a loff_t,
> which is signed, gets turned into -1. later in vfs_setpos we have
> 'if (offset > maxsize)', which makes it always return EINVAL.

Patch itself looks reasonable, and the bug was introduced in commit
b25472f9b "new helpers: no_seek_end_llseek{,_size}()".

Wouter, you need to resubmit this with your "Signed-off-by:" line,
see linux/Documentation/SubmittingPatches for details, and the patch
should be sent "To: Al Viro" and "CC: linux-fsdevel" so it isn't lost.

When you resubmit you can add my:

Reviewed-by: Andreas Dilger <adilger@dilger.ca>

Cheers, Andreas

> ---
> fs/read_write.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/read_write.c b/fs/read_write.c
> index 324ec27..0c8782a 100644
> --- a/fs/read_write.c
> +++ b/fs/read_write.c
> @@ -17,6 +17,7 @@
> #include <linux/splice.h>
> #include <linux/compat.h>
> #include <linux/mount.h>
> +#include <linux/fs.h>
> #include "internal.h"
> 
> #include <asm/uaccess.h>
> @@ -183,7 +184,7 @@ loff_t no_seek_end_llseek(struct file *file, loff_t offset, int whence)
> 	switch (whence) {
> 	case SEEK_SET: case SEEK_CUR:
> 		return generic_file_llseek_size(file, offset, whence,
> -						~0ULL, 0);
> +						OFFSET_MAX, 0);
> 	default:
> 		return -EINVAL;
> 	}
> -- 
> 2.7.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Cheers, Andreas






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

end of thread, other threads:[~2016-02-16 20:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-05 16:08 [PATCH] fs: allow no_seek_end_llseek to actually seek Wouter van Kesteren
2016-02-16 20:35 ` [PATCH] " Andreas Dilger

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 read-only IMAP folder(s) and NNTP newsgroup(s).