linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: crosslonelyover <crosslonelyover@gmail.com>
Cc: linux-ext4 <linux-ext4@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	kernel-janitors <kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH] remove unnecesary while loop in ext2_xattr_get
Date: Mon, 12 Jul 2010 18:40:43 +0200	[thread overview]
Message-ID: <20100712164018.GC5658@bicker> (raw)
In-Reply-To: <201007122309063128435@gmail.com>

On Mon, Jul 12, 2010 at 11:09:09PM +0800, crosslonelyover wrote:
> Hi,
>      In ext2_xattr_get, we'll check the xattr entry one 
> by one in the following loop:
>          entry = FIRST_ENTRY(bh);
>          while (!IS_LAST_ENTRY(entry)) {
>                  struct ext2_xattr_entry *next =
>                          EXT2_XATTR_NEXT(entry);
>                  if ((char *)next >= end)
>                          goto bad_block;
>                  if (name_index == entry->e_name_index &&
>                      name_len == entry->e_name_len &&
>                      memcmp(name, entry->e_name, name_len) == 0)
>                          goto found;
>                  entry = next;
>          }
> We can only execute the code immediately following 
> the loop when !IS_LAST_ENTRY(entry) is true. So the
> followed while loop seems unnecessary. I think we can
> remove it.
>       Following is my patch. It's against 2.6.35-rc4.
> Please check it.
> 

Yes.  This is dead code.  This stuff is from the days before git
so we'll never know who to blame for it.

Reviewed-by: Dan Carpenter <error27@gmail.com>

regards,
dan carpenter


      reply	other threads:[~2010-07-12 16:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-12 15:09 [PATCH] remove unnecesary while loop in ext2_xattr_get crosslonelyover
2010-07-12 16:40 ` Dan Carpenter [this message]

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=20100712164018.GC5658@bicker \
    --to=error27@gmail.com \
    --cc=crosslonelyover@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).