Return-Path: Received: from mail-wm0-f44.google.com ([74.125.82.44]:33293 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932614AbcBPVVK (ORCPT ); Tue, 16 Feb 2016 16:21:10 -0500 Received: by mail-wm0-f44.google.com with SMTP id g62so210103733wme.0 for ; Tue, 16 Feb 2016 13:21:09 -0800 (PST) From: Wouter van Kesteren To: viro@zeniv.linux.org.uk Cc: linux-fsdevel@vger.kernel.org Subject: [PATCH] fs: allow no_seek_end_llseek to actually seek Date: Tue, 16 Feb 2016 22:20:59 +0100 Message-Id: <1455657659-3690442-1-git-send-email-woutershep@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: The user-visible impact of the issue is for example that without this patch sensors-detect breaks when trying to seek in /dev/cpu/0/cpuid. '~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. Fixes: b25472f9b961 ("new helpers: no_seek_end_llseek{,_size}()") Signed-off-by: Wouter van Kesteren Reviewed-by: Andreas Dilger --- 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 #include #include +#include #include "internal.h" #include @@ -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.1