public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Namjae Jeon <linkinjeon@gmail.com>
Cc: akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Namjae Jeon <namjae.jeon@samsung.com>,
	Ravishankar N <ravi.n1@samsung.com>,
	Amit Sahrawat <a.sahrawat@samsung.com>
Subject: Re: [PATCH v6 4/7] fat: restructure export_operations
Date: Mon, 18 Feb 2013 23:38:07 +0900	[thread overview]
Message-ID: <87d2vxznzk.fsf@devron.myhome.or.jp> (raw)
In-Reply-To: <CAKYAXd9cxUJwObHUfh0Rf9jVLzmvpfnYx4AKw6tsSAX-jzDusA@mail.gmail.com> (Namjae Jeon's message of "Mon, 18 Feb 2013 23:03:45 +0900")

Namjae Jeon <linkinjeon@gmail.com> writes:

>>> +     if (parent && (len < FAT_FID_SIZE_WITH_PARENT)) {
>>> +             *lenp = FAT_FID_SIZE_WITH_PARENT;
>>> +             return 255;
>>> +     } else if (len < FAT_FID_SIZE_WITHOUT_PARENT) {
>>> +             *lenp = FAT_FID_SIZE_WITHOUT_PARENT;
>>> +             return 255;
>>> +     }
>>
>> This check strange. "parent && len == FAT_FID_SIZE_WITHOUT_PARENT" will
>> overwrite over limit of fh size?
> I need to check more. because I followed the logic in
> export_encode_fh() function.

Ah, my fault, it doesn't have real problem. But code is quite strange.

If input is "parent && len >= FAT_FID_SIZE_WITHOUT_PARENT", "else if
(len < FAT_FID_SIZE_WITHOUT_PARENT)" check is entirely useless, but this
code itself checks "len".

if (parent) {
	if (len < FAT_FID_SIZE_WITH_PARENT)
		/* error */
} else {
	if (len < FAT_FID_SIZE_WITHOUT_PARENT)
		/* error */
}

I think this would readable, and I guess this will generates faster/simpler
code (at least, this doesn't depends an optimization of gcc).

Thanks.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

  reply	other threads:[~2013-02-18 14:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-09 15:02 [PATCH v6 4/7] fat: restructure export_operations Namjae Jeon
2013-02-18 11:06 ` OGAWA Hirofumi
2013-02-18 11:42   ` OGAWA Hirofumi
2013-02-18 14:05     ` Namjae Jeon
2013-02-18 14:03   ` Namjae Jeon
2013-02-18 14:38     ` OGAWA Hirofumi [this message]
2013-02-18 14:49       ` Namjae Jeon

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=87d2vxznzk.fsf@devron.myhome.or.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=a.sahrawat@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=linkinjeon@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namjae.jeon@samsung.com \
    --cc=ravi.n1@samsung.com \
    /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