mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wu Fengguang <fengguang.wu@intel.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Dave Jones <davej@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Subject: Re: [PATCH] /dev/mem: Allow rewinding
Date: Tue, 6 Apr 2010 13:15:20 +0800	[thread overview]
Message-ID: <20100406051520.GA18059@localhost> (raw)
In-Reply-To: <1270502345.9013.31.camel@edumazet-laptop>

On Tue, Apr 06, 2010 at 05:19:05AM +0800, Eric Dumazet wrote:
> Le lundi 05 avril 2010 à 23:04 +0200, Eric Dumazet a écrit :
> > Andrew, commit dcefafb6ac90ece8d68a6c203105f3d313e52da4 seems to be the
> > problem. 
> > 
> > It breaks rewinds (negative offsets to lseek (... SEEK_CUR))
> > 
> 
> Here is a patch to make rewind working again on /dev/mem

Looks good to me. Thanks for the fix!

Thanks,
Fengguang

> [PATCH] /dev/mem: Allow rewinding
> 
> commit dcefafb6 (/dev/mem: dont allow seek to last page)
> inadvertently disabled rewinding on /dev/mem.
> 
> This broke x86info for example.
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> ---
> diff --git a/drivers/char/mem.c b/drivers/char/mem.c
> index 1f3215a..3973a1d 100644
> --- a/drivers/char/mem.c
> +++ b/drivers/char/mem.c
> @@ -710,11 +710,6 @@ static loff_t memory_lseek(struct file *file, loff_t offset, int orig)
>  	switch (orig) {
>  	case SEEK_CUR:
>  		offset += file->f_pos;
> -		if ((unsigned long long)offset <
> -		    (unsigned long long)file->f_pos) {
> -			ret = -EOVERFLOW;
> -			break;
> -		}
>  	case SEEK_SET:
>  		/* to avoid userland mistaking f_pos=-9 as -EBADF=-9 */
>  		if ((unsigned long long)offset >= ~0xFFFULL) {
> 
> 

  reply	other threads:[~2010-04-06  5:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-05 20:24 [BUG] x86info fails on 2.6.34 ? Eric Dumazet
2010-04-05 21:04 ` Eric Dumazet
2010-04-05 21:19   ` [PATCH] /dev/mem: Allow rewinding Eric Dumazet
2010-04-06  5:15     ` Wu Fengguang [this message]
2010-04-06  5:30     ` Américo Wang
2010-04-06  5:43       ` Wu Fengguang
2010-04-06  6:24         ` Américo Wang
2010-04-06  6:21       ` Eric Dumazet

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=20100406051520.GA18059@localhost \
    --to=fengguang.wu@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=davej@redhat.com \
    --cc=eric.dumazet@gmail.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®