lkml.org 
[lkml]   [2007]   [Jul]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [git patches 1/2] warnings: attack valid cases spotted by warnings


    On Tue, 17 Jul 2007, Roland Dreier wrote:
    >
    > So setting a variable to something meaningless (guaranteeing that a
    > garbage value is used in case of a bug) just to shut up a warning makes
    > no sense -- it's no safer than leaving the code as is.

    Wrong.

    It's safer for two reasons:
    - now everybody will see the *same* behaviour
    - the "meaningless value" is guaranteed to not be a security leak

    but the whole "shut up bogus warnings" is the best reason.

    So it *is* safer than leaving the code as-is.

    Of course, usually the best approach is to rewrite the code to be simpler,
    so that even gcc sees that something is obviously initialized. Sadly,
    people seldom do the right thing, and sometimes gcc just blows incredibly
    hard.

    Linus
    -
    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: 2007-07-18 05:01    [W:0.019 / U:3.644 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site