public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Mike Hommey <mh@glandium.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	Steven Whitehouse <swhiteho@redhat.com>,
	"Theodore Ts'o" <tytso@mit.edu>,
	Eric Sandeen <sandeen@redhat.com>,
	Josef Bacik <jbacik@redhat.com>, Mark Fasheh <mfasheh@suse.com>
Subject: Re: [PATCH] Fix generic_block_fiemap for files bigger than 4GB
Date: Thu, 29 Oct 2009 08:31:54 -0400	[thread overview]
Message-ID: <20091029123153.GA7436@localhost.localdomain> (raw)
In-Reply-To: <20091028230022.e15b1e9c.akpm@linux-foundation.org>

On Wed, Oct 28, 2009 at 11:00:22PM -0700, Andrew Morton wrote:
> On Mon, 26 Oct 2009 18:24:28 +0100 Mike Hommey <mh@glandium.org> wrote:
> 
> > Because of an integer overflow on start_blk, various kind of wrong results
> > would be returned by the generic_block_fiemap handler, such as no extents
> > when there is a 4GB+ hole at the beginning of the file, or wrong fe_logical
> > when an extent starts after the first 4GB.
> > 
> > Signed-off-by: Mike Hommey <mh@glandium.org>
> > ---
> >  fs/ioctl.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/fs/ioctl.c b/fs/ioctl.c
> > index 7b17a14..6c75110 100644
> > --- a/fs/ioctl.c
> > +++ b/fs/ioctl.c
> > @@ -254,7 +254,7 @@ int __generic_block_fiemap(struct inode *inode,
> >  			   u64 len, get_block_t *get_block)
> >  {
> >  	struct buffer_head tmp;
> > -	unsigned int start_blk;
> > +	unsigned long long start_blk;
> >  	long long length = 0, map_len = 0;
> >  	u64 logical = 0, phys = 0, size = 0;
> >  	u32 flags = FIEMAP_EXTENT_MERGED;
> 
> Well.  Should it be unsigned long long, or u64 or sector_t?  Or even loff_t.
> 
> The code's a bit confused about types in there.  And it's made much
> more confusing by the moronic and wholly unnecessary use of macros for
> blk_to_logical() and logical_to_blk().
> 
> It's also unhelpful that the `u64 start' argument forgot to get itself
> documented in the kerneldoc comment.  Sigh.
> 
> Ah, generic_block_fiemap() has it:
> 
>  * @start: The initial block to map
> 
> I guess u64 was logical there as it comes in from userspace.  But at
> some boundary we should start talking kernel types so I suspect the
> correct thing to do here is to use sector_t?
> 

Hmm this is strange, I had sent a patch a few months ago after you chewed me out
the first time for this to change all the types and such and make the macro's
inlined functions.  I will see if I can find it and resend it.  Thanks,

Josef

  reply	other threads:[~2009-10-29 12:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-26 17:24 [PATCH] Fix generic_block_fiemap for files bigger than 4GB Mike Hommey
2009-10-29  6:00 ` Andrew Morton
2009-10-29 12:31   ` Josef Bacik [this message]
2009-10-29 12:40     ` Josef Bacik
2009-10-29 15:17       ` Andrew Morton
2009-10-29 15:19         ` Mike Hommey

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=20091029123153.GA7436@localhost.localdomain \
    --to=josef@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=jbacik@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mfasheh@suse.com \
    --cc=mh@glandium.org \
    --cc=sandeen@redhat.com \
    --cc=swhiteho@redhat.com \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --cc=viro@zeniv.linux.org.uk \
    /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