30 Oct, 2020

1 commit

  • In preparation to enable -Wimplicit-fallthrough for Clang, explicitly
    add break statements instead of letting the code fall through to the
    next case.

    This patch adds four break statements that, together, fix almost 40,000
    warnings when building Linux 5.10-rc1 with Clang 12.0.0 and this[1] change
    reverted. Notice that in order to enable -Wimplicit-fallthrough for Clang,
    such change[1] is meant to be reverted at some point. So, this patch helps
    to move in that direction.

    Something important to mention is that there is currently a discrepancy
    between GCC and Clang when dealing with switch fall-through to empty case
    statements or to cases that only contain a break/continue/return
    statement[2][3][4].

    Now that the -Wimplicit-fallthrough option has been globally enabled[5],
    any compiler should really warn on missing either a fallthrough annotation
    or any of the other case-terminating statements (break/continue/return/
    goto) when falling through to the next case statement. Making exceptions
    to this introduces variation in case handling which may continue to lead
    to bugs, misunderstandings, and a general lack of robustness. The point
    of enabling options like -Wimplicit-fallthrough is to prevent human error
    and aid developers in spotting bugs before their code is even built/
    submitted/committed, therefore eliminating classes of bugs. So, in order
    to really accomplish this, we should, and can, move in the direction of
    addressing any error-prone scenarios and get rid of the unintentional
    fallthrough bug-class in the kernel, entirely, even if there is some minor
    redundancy. Better to have explicit case-ending statements than continue to
    have exceptions where one must guess as to the right result. The compiler
    will eliminate any actual redundancy.

    [1] commit e2079e93f562c ("kbuild: Do not enable -Wimplicit-fallthrough for clang for now")
    [2] https://github.com/ClangBuiltLinux/linux/issues/636
    [3] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91432
    [4] https://godbolt.org/z/xgkvIh
    [5] commit a035d552a93b ("Makefile: Globally enable fall-through warning")

    Co-developed-by: Kees Cook
    Signed-off-by: Kees Cook
    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

24 Aug, 2020

1 commit

  • Replace the existing /* fall through */ comments and its variants with
    the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
    fall-through markings when it is the case.

    [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

13 Aug, 2020

1 commit

  • Rationale:
    Reduces attack surface on kernel devs opening the links for MITM
    as HTTPS traffic is much harder to manipulate.

    Signed-off-by: Alexander A. Klimov
    Signed-off-by: Andrew Morton
    Reviewed-by: Kees Cook
    Link: http://lkml.kernel.org/r/20200726110117.16346-1-grandmaster@al2klimov.de
    Signed-off-by: Linus Torvalds

    Alexander A. Klimov
     

10 Jun, 2019

1 commit

  • It's better to use my kadlec@netfilter.org email address in
    the source code. I might not be able to use
    kadlec@blackhole.kfki.hu in the future.

    Signed-off-by: Jozsef Kadlecsik
    Signed-off-by: Jozsef Kadlecsik

    Jozsef Kadlecsik
     

18 Jul, 2017

1 commit

  • GCC 7 added a new -Wimplicit-fallthrough warning. It's only enabled
    with W=1, but since linux/jhash.h is included in over hundred places
    (including other global headers) it seems worthwhile fixing this
    warning.

    Signed-off-by: Jakub Kicinski
    Signed-off-by: David S. Miller

    Jakub Kicinski
     

04 Apr, 2015

1 commit

  • Looking over the implementation for jhash2 and comparing it to jhash_3words
    I realized that the two hashes were in fact very different. Doing a bit of
    digging led me to "The new jhash implementation" in which lookup2 was
    supposed to have been replaced with lookup3.

    In reviewing the patch I noticed that jhash2 had originally initialized a
    and b to JHASH_GOLDENRATIO and c to initval, but after the patch a, b, and
    c were initialized to initval + (length << 2) + JHASH_INITVAL. However the
    changes in jhash_3words simply replaced the initialization of a and b with
    JHASH_INITVAL.

    This change corrects what I believe was an oversight so that a, b, and c in
    jhash_3words all have the same value added consisting of initval + (length
    << 2) + JHASH_INITVAL so that jhash2 and jhash_3words will now produce the
    same hash result given the same inputs.

    Fixes: 60d509c823cca ("The new jhash implementation")
    Signed-off-by: Alexander Duyck
    Signed-off-by: David S. Miller

    Alexander Duyck
     

10 Dec, 2010

1 commit

  • The current jhash.h implements the lookup2() hash function by Bob Jenkins.
    However, lookup2() is outdated as Bob wrote a new hash function called
    lookup3(). The patch replaces the lookup2() implementation of the 'jhash*'
    functions with that of lookup3().

    You can read a longer comparison of the two and other hash functions at
    http://burtleburtle.net/bob/hash/doobs.html.

    Signed-off-by: Jozsef Kadlecsik
    Acked-by: Rusty Russell
    Signed-off-by: David S. Miller

    Jozsef Kadlecsik
     

18 Aug, 2010

1 commit


26 Apr, 2007

1 commit


17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds