All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Theodore Ts'o <tytso@mit.edu>
Cc: Jan Kara <jack@suse.cz>, linux-ext4@vger.kernel.org
Subject: Re: Mixup with name_len & file_type in e2fsprogs
Date: Tue, 5 Mar 2013 19:41:38 +0100	[thread overview]
Message-ID: <20130305184138.GA19601@quack.suse.cz> (raw)
In-Reply-To: <20130305182946.GB26122@thunk.org>

On Tue 05-03-13 13:29:46, Ted Tso wrote:
> On Tue, Mar 05, 2013 at 01:18:56PM +0100, Jan Kara wrote:
> >   Hello,
> > 
> >   I was looking into a bug where application using e2fslib was complaining
> > about file_type > 7. Now the problem is that this is on big endian system
> > and ext2fs_dir_iterate() ends up calling ext2fs_dirent_swab_in() without
> > EXT2_DIRBLOCK_V2_STRUCT flag set so name_len is treated as 2 byte and
> > swapped.
> 
> Well, the application most be passing a pointer to treating a pointer
> to a struct ext2_dir_entry as a struct dir_entry_2, right?  So it's
> technically doing something wrong it sounds like.
  Yes, that is correct. Although it is easy to think along the lines of
"I know the dirents are in v2 format but there's no way to iterate over a
directory and get v2 dirent so I will just cast the v1 argument." And
although that is wrong as you point out I did that myself a few times
because I didn't know a better way.
 
> The ext2_dir_entry_2 was probably a mistake, and it's hardly used at
> all in e2fsprogs.  I wonder if we would be better off not trying to
> support it at all, and perhaps adding better accessor functions for
> struct ext2_dir_entry instead.
  Yeah, that sounds like an easier solution. I'll write a patch for that.
Thanks for the idea.

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  reply	other threads:[~2013-03-05 18:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-05 12:18 Mixup with name_len & file_type in e2fsprogs Jan Kara
2013-03-05 18:29 ` Theodore Ts'o
2013-03-05 18:41   ` Jan Kara [this message]
2013-03-07 18:24     ` Jan Kara
2013-03-07 23:00       ` Andreas Dilger
2013-03-08  0:44       ` Theodore Ts'o
2013-03-08  0:46       ` Theodore Ts'o
2013-03-11 14:18         ` Jan Kara

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=20130305184138.GA19601@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.