07 Jan, 2009

22 commits

  • Signed-off-by: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • Clean up checkpatch using perlcritic.

    Signed-off-by: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • In the general use case struct file_operations should be a const object.
    Check for and warn where it is not. As suggested by Steven and Ingo.

    Acked-by: Steven Rostedt
    Cc: Ingo Molnar
    Signed-off-by: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • When checking for assignments within if conditionals we check the whole of
    the condition, but the match is performed using a line constrained regular
    expression. This means we can miss split conditionals or those on the
    second line. Allow the check to span lines.

    Signed-off-by: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • Ensure we do not report identifiers containing the word static as static
    declarations. For example this should not be reported as an unecessary
    assignement of 0:

    long nr_static = 0;

    Signed-off-by: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • When picking up a complete statement or block for analysis we cannot
    simply track open/close/etc parenthesis we must take into account
    preprocessor section boundaries.

    Signed-off-by: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • We are miscategorising a continuation fragment following an operator
    which may lead to us thinking that there is a space after it when there is
    not. Fix this up.

    Signed-off-by: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • Loosen spacing checks to correctly detect this valid use of a typedef:

    typedef struct rcu_data *(*get_data_func)(int);

    Signed-off-by: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • Seems like every other release we have someone who updates vmlinux.lds.h
    and adds C-visible symbols without VMLINUX_SYMBOL() around them. So start
    checking the file and reject assignments which have plain symbols on
    either side.

    [apw@canonical.com: soften the check, add tests]
    Signed-off-by: Mike Frysinger
    Signed-off-by: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Frysinger
     
  • It seems to be a common idiom to include braces on conditionals in all
    contexts including return. Allow this exception to the return is not a
    function checks. Reported by Kay Sievers.

    Cc: Kay Sievers
    Signed-off-by: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • Some people work internally with -p0-patches which has the danger that one
    forgets to convert them to -p1 before mainlining. Bitten myself and seen
    p0-patches in mailing lists occasionally, this patch adds a warning to
    checkpatch.pl in case a patch is -p0. If you really want, you can fool
    this check to generate false positives, this is why it just spits a
    warning. Making the check 100% proof is trickier than it looks, so let's
    start with a version which catches the cases of real use.

    [apw@canonical.com: update message language, handle null prefix, add tests]
    Signed-off-by: Wolfram Sang
    Signed-off-by: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Wolfram Sang
     
  • Signed-off-by: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • Signed-off-by: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • Disallow spaces within multiple pointer stars (*) in both casts and
    definitions. Both of these would now be reported:

    (char * *)
    char * *foo;

    Also now consistently detects and reports the attributes within these
    structures making the error report itself clearer.

    Signed-off-by: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • When we are detecting whether a comment is open when we start a hunk we
    check for the first comment edge in the hunk and assume its inverse.
    However if the hunk contains something like below, then we will assume
    that a comment was open. Update this heuristic to see if the comment edge
    is obviously within double quotes and ignore it if so:

    foo(" */);

    Signed-off-by: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • Detect the colons (:) which make up secondary bitfield declarations and
    apply binary colon checks. For example the following is common idiom:

    int foo:1,
    bar:1;

    Signed-off-by: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • Add __weak as an official attribute. This tends to be used in a location
    where the automated attribute detector misses it.

    Signed-off-by: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • Ensure we do not trigger the complex macros checks on structure member
    assignment, for example:

    #define foo .bar = 10

    Signed-off-by: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • Some people use double star '**' as a comment continuation, and start
    comments with complete lines of stars. Widen the implied comment
    detection to pick these up.

    Signed-off-by: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • When detecting implied comments from leading stars we may incorrectly
    think we have detected an edge one way or the other when we have not if we
    drop off the end of the last hunk. Fix this up.

    Signed-off-by: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • in_atomic() is not for driver use so report any such use as an ERROR.
    Also in_atomic() is often used to determine if we may sleep, but it is not
    reliable in this use model therefore strongly discourage its use.

    Signed-off-by: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • We're struggling all the time to figure out where the code came from that
    oopsed.. The script below (a adaption from a script used by
    kerneloops.org) can help developers quite a bit, at least for non-module
    cases.

    It works and looks like this:

    [/home/arjan/linux]$ dmesg | perl scripts/markup_oops.pl vmlinux
    {
    struct agp_memory *memory;

    memory = agp_allocate_memory(agp_bridge, pg_count, type);
    c055c10f: 89 c2 mov %eax,%edx
    if (memory == NULL)
    c055c111: 74 19 je c055c12c
    /* This function must only be called when current_controller != NULL */
    static void agp_insert_into_pool(struct agp_memory * temp)
    {
    struct agp_memory *prev;

    prev = agp_fe.current_controller->pool;
    c055c113: a1 ec dc 8f c0 mov 0xc08fdcec,%eax
    *c055c118: 8b 40 10 mov 0x10(%eax),%eax
    prev->prev = temp;
    c055c11f: 89 50 04 mov %edx,0x4(%eax)
    temp->next = prev;
    c055c122: 89 02 mov %eax,(%edx)
    }
    agp_fe.current_controller->pool = temp;
    c055c124: a1 ec dc 8f c0 mov 0xc08fdcec,%eax
    c055c129: 89 50 10 mov %edx,0x10(%eax)
    if (memory == NULL)
    return NULL;

    agp_insert_into_pool(memory);

    so in this case, we faulted while dereferencing agp_fe.current_controller
    pointer, and we get to see exactly which function and line it affects...
    Personally I find this very useful, and I can see value for having this
    script in the kernel for more-than-just-me to use.

    Caveats:
    * It only works for oopses not-in-modules
    * It only works nicely for kernels compiled with CONFIG_DEBUG_INFO
    * It's not very fast.
    * It only works on x86

    Signed-off-by: Arjan van de Ven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arjan van de Ven
     

03 Jan, 2009

10 commits


29 Dec, 2008

1 commit

  • * git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-next: (25 commits)
    allow stripping of generated symbols under CONFIG_KALLSYMS_ALL
    kbuild: strip generated symbols from *.ko
    kbuild: simplify use of genksyms
    kernel-doc: check for extra kernel-doc notations
    kbuild: add headerdep used to detect inclusion cycles in header files
    kbuild: fix string equality testing in tags.sh
    kbuild: fix make tags/cscope
    kbuild: fix make incompatibility
    kbuild: remove TAR_IGNORE
    setlocalversion: add git-svn support
    setlocalversion: print correct subversion revision
    scripts: improve the decodecode script
    scripts/package: allow custom options to rpm
    genksyms: allow to ignore symbol checksum changes
    genksyms: track symbol checksum changes
    tags and cscope support really belongs in a shell script
    kconfig: fix options to check-lxdialog.sh
    kbuild: gen_init_cpio expands shell variables in file names
    remove bashisms from scripts/extract-ikconfig
    kbuild: teach mkmakfile to be silent
    ...

    Linus Torvalds
     

20 Dec, 2008

4 commits

  • Building upon parts of the module stripping patch, this patch
    introduces similar stripping for vmlinux when CONFIG_KALLSYMS_ALL=y.
    Using CONFIG_KALLSYMS_STRIP_GENERATED reduces the overhead of
    CONFIG_KALLSYMS_ALL from 245k/310k to 65k/80k for the (i386/x86-64)
    kernels I tested with.

    The patch also does away with the need to special case the kallsyms-
    internal symbols by making them available even in the first linking
    stage.

    While it is a generated file, the patch includes the changes to
    scripts/genksyms/keywords.c_shipped, as I'm unsure what the procedure
    here is.

    Signed-off-by: Jan Beulich
    Signed-off-by: Sam Ravnborg

    Jan Beulich
     
  • This patch changes the way __crc_ symbols are being resolved from
    using ld to do so to using the assembler, thus allowing these symbols
    to be marked local (the linker creates then as global ones) and hence
    allow stripping (for modules) or ignoring (for vmlinux) them. While at
    this, also strip other generated symbols during module installation.

    One potentially debatable point is the handling of the flags passeed
    to gcc when translating the intermediate assembly file into an object:
    passing $(c_flags) unchanged doesn't work as gcc passes --gdwarf2 to
    gas whenever is sees any -g* option, even for -g0, and despite the
    fact that the compiler would have already produced all necessary debug
    info in the C->assembly translation phase. I took the approach of just
    filtering out all -g* options, but an alternative to such negative
    filtering might be to have a positive filter which might, in the ideal
    case allow just all the -Wa,* options to pass through.

    Signed-off-by: Jan Beulich
    Signed-off-by: Sam Ravnborg

    Jan Beulich
     
  • Avoid duplicating long list of options in two places

    Signed-off-by: Sam Ravnborg

    Sam Ravnborg
     
  • Add functionality to check for function parameters or structure (or
    union/typedef/enum) field members that are described in kernel-doc but
    are not part of the expected (declared) parameters or structure.
    These generate warnings that are called "Excess" descriptions.

    Signed-off-by: Randy Dunlap
    Signed-off-by: Sam Ravnborg

    Randy Dunlap
     

19 Dec, 2008

1 commit


14 Dec, 2008

2 commits