lkml.org 
[lkml]   [2004]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] Remove pointless <0 comparison for unsigned variable in fs/fcntl.c
    On Sun, Nov 21, 2004 at 11:55:23PM +0100, Jesper Juhl wrote:
    > This patch removes a pointless comparison. "arg" is an unsigned long, thus
    > it can never be <0, so testing that is pointless.
    >
    > Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
    >
    > case F_SETSIG:
    > /* arg == 0 restores default behaviour. */
    > - if (arg < 0 || arg > _NSIG) {
    > + if (arg > _NSIG) {
    > break;

    I've seen patches like this before. I'm generally in favour of removing
    the unnecessary test, but Linus rejected it on the grounds the compiler
    shouldn't be warning about it and it's better to be more explicit about
    the range test. Maybe he's changed his mind between then and now ;-)

    --
    "Next the statesmen will invent cheap lies, putting the blame upon
    the nation that is attacked, and every man will be glad of those
    conscience-soothing falsities, and will diligently study them, and refuse
    to examine any refutations of them; and thus he will by and by convince
    himself that the war is just, and will thank God for the better sleep
    he enjoys after this process of grotesque self-deception." -- Mark Twain
    -
    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/

    \
     
     \ /
      Last update: 2005-03-22 14:08    [W:0.021 / U:93.528 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site