All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rogério Brito" <rbrito@ime.usp.br>
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/13] FAT: Return better error codes from vfat_valid_longname()
Date: Tue, 18 Jan 2005 00:03:25 -0200	[thread overview]
Message-ID: <20050118020324.GC11257@ime.usp.br> (raw)
In-Reply-To: <87d5w4osuv.fsf_-_@devron.myhome.or.jp>

On Jan 18 2005, OGAWA Hirofumi wrote:
>  static int vfat_valid_longname(const unsigned char *name, unsigned int len)
>  {
> -	if (len && name[len-1] == ' ')
> -		return 0;
> +	if (name[len - 1] == ' ')
> +		return -EINVAL;

Sorry for the stupid question, but is len guaranteed to be always greater
than zero?

Otherwise, I think that the test with len would be warranted.  And, if that
is the case, wouldn't it be better to have it explicitly say if (len > 0...)?

Just curious. And sorry again for the stupid question. But as Knuth says,
"premature optimization is the root of all evil".

Perhaps I'm way too much into proving invariants of algorithms. :-)


Thanks for your work, Rogério.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  Rogério Brito - rbrito@ime.usp.br - http://www.ime.usp.br/~rbrito
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

  parent reply	other threads:[~2005-01-18  2:21 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-17 17:39 [PATCH 1/13] FAT: kill fatfs_syms.c OGAWA Hirofumi
2005-01-17 17:40 ` [PATCH 2/13] FAT: merge msdos_fs_{i,sb}.h into msdos_fs.h OGAWA Hirofumi
2005-01-17 17:41   ` [PATCH 3/13] FAT: IS_BADCHAR/IS_REPLACECHR/IS_SKIPCHAR cleanup OGAWA Hirofumi
2005-01-17 17:42     ` [PATCH 4/13] FAT: Return better error codes from vfat_valid_longname() OGAWA Hirofumi
2005-01-17 17:42       ` [PATCH 5/13] FAT: Manually inline shortname_info_to_lcase() OGAWA Hirofumi
2005-01-17 17:44         ` [PATCH 6/13] FAT: use vprintk instead of snprintf with static buffer OGAWA Hirofumi
2005-01-17 17:44           ` [PATCH 7/13] FAT: kill unnecessary kmap() OGAWA Hirofumi
2005-01-17 17:47             ` [PATCH 8/13] FAT: fs/fat/cache.c: make __fat_access static OGAWA Hirofumi
2005-01-17 17:48               ` [PATCH 9/13] FAT: Lindent fs/msdos/namei.c OGAWA Hirofumi
2005-01-17 17:49                 ` [PATCH 10/13] FAT: Lindent fs/vfat/namei.c OGAWA Hirofumi
2005-01-17 17:50                   ` [PATCH 11/13] FAT: fs/fat/* cleanup OGAWA Hirofumi
2005-01-17 17:52                     ` [PATCH 12/13] FAT: reserved clusters cleanup OGAWA Hirofumi
2005-01-17 17:54                       ` [PATCH 13/13] FAT: show current nls config even if it's default OGAWA Hirofumi
2005-01-17 19:12                   ` [PATCH 10/13] FAT: Lindent fs/vfat/namei.c Sytse Wielinga
2005-01-18  1:06                     ` OGAWA Hirofumi
2005-01-18  2:03       ` Rogério Brito [this message]
2005-01-18  2:29         ` [PATCH 4/13] FAT: Return better error codes from vfat_valid_longname() OGAWA Hirofumi
2005-01-18  2:57           ` Rogério Brito
2005-01-17 18:33     ` [PATCH 3/13] FAT: IS_BADCHAR/IS_REPLACECHR/IS_SKIPCHAR cleanup Al Viro
2005-01-18  1:04       ` OGAWA Hirofumi

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=20050118020324.GC11257@ime.usp.br \
    --to=rbrito@ime.usp.br \
    --cc=akpm@osdl.org \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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 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.