Re: [PATCH 4/13] FAT: Return better error codes from vfat_valid_longname()

From: Rogério Brito (rbrito_at_ime.usp.br)
Date: 01/18/05

  • Next message: Matthew Wilcox: "PCI patches not being reviewed"
    Date:	Tue, 18 Jan 2005 00:03:25 -0200
    To: OGAWA Hirofumi <hirofumi@mail.parknet.co.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
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: Matthew Wilcox: "PCI patches not being reviewed"

    Relevant Pages

    • Re: [PATCH 4/13] FAT: Return better error codes from vfat_valid_longname()
      ... On Jan 18 2005, OGAWA Hirofumi wrote: ... >> than zero? ... Sorry for the stupid question then. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: 2.6.8-rc2-mm2
      ... whirl. ... | Stupid question though - do I apply this to 2.6.8rc2 or does it bring ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Maximum number of sockets...
      ... > It may seem a pretty stupid question, but what do I need to ... > modify in a 2.4.22 kernel to increase the maximum number of sockets ... Maybe you just need to set new per-process open file limits? ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Wireless Driver Development
      ... I searching for some documentation about writing wireless drivers, ... There's one more stupid question: ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • /proc/kcore size incorrect ?
      ... Probably this is a stupid question, ... I'm trying to make a script to generate an /etc/motd, ... include memory size of the box. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)