11 Jan, 2012

15 commits

  • Fix up type and cast spacing checks such that all occurences on a line are
    examined and reported. For example the line below has a valid cast and a
    bad type, but currently we check the cast first which is good and stop:

    u16* bar = (u16 *)baz;

    We will also only report one of the errors in this example:

    u16* bar = (u16*)bad;

    Move to iterating across all casts and all types, reporting any failure.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Andy Whitcroft
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • typeof may have various more complex forms as its arguement, not just an
    identifier. For now allow us to leak to the first close perenthesis ')'.

    Signed-off-by: Andy Whitcroft
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • Ensure the cast type is unique in the context parser, we do not want them
    to detect as a comma ','.

    Signed-off-by: Andy Whitcroft
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

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

    Andy Whitcroft
     
  • We are incorrectly matching square brackets '[' and ']' leading to false
    positives on more complex functions as below:

    return (dt3155_fbuffer[m]->ready_head -
    dt3155_fbuffer[m]->ready_len +
    dt3155_fbuffer[m]->nbuffers)%
    (dt3155_fbuffer[m]->nbuffers);

    Signed-off-by: Andy Whitcroft
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • It is common to stub out a function as below, this is triggering a complex
    macro format incorrectly. Sort this out:

    #define cma_early_regions_reserve(reserve) do { } while (0)

    Signed-off-by: Andy Whitcroft
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • The following fragment defeats the DEVICE_ATTR style handing, check for
    and ignore the close brace '}' in this context:

    int foo()
    {
    }
    DEVICE_ATTR(link_power_management_policy, S_IRUGO | S_IWUSR,
    ata_scsi_lpm_show, ata_scsi_lpm_put);
    EXPORT_SYMBOL_GPL(dev_attr_link_power_management_policy);

    Signed-off-by: Andy Whitcroft
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • The intent of this check is to catch the options which the user will see
    and ensure they are properly described. It is also common for internal
    only options to have a brief description. Allow this form.

    Reported-by: Steven Rostedt
    Tested-by: Steven Rostedt
    Signed-off-by: Andy Whitcroft
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • In the middle of a long definition or similar, there is no possibility of
    finding a smaller sub-statement. Optimise this case by skipping statement
    aquirey where there are no starts of statement (open brace '{' or
    semi-colon ';'). We are likely to scan slightly more than needed still
    but this is safest.

    Signed-off-by: Andy Whitcroft
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • Inserting a # into the modifiers list will incorrectly add the null string
    to the modifiers list, leading to an infinite loop. As neither of these
    is a valid modifier form simply ignore them.

    Signed-off-by: Andy Whitcroft
    Reported-by: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • Improve the checking of arguments to memset and min/max tests.

    Move the checking of min/max to statement blocks instead of single line.
    Change $Constant to allow any case type 0x initiator and trailing ul
    specifier. Add $FuncArg type as any function argument with or without a
    cast. Print the whole statement when showing memset or min/max messages.
    Improve the memset with 0 as 3rd argument error message.

    There are still weaknesses in the $FuncArg and $Constant code as arbitrary
    parentheses and negative signs are not generically supported.

    [akpm@linux-foundation.org: fix per Andy]
    Signed-off-by: Joe Perches
    Acked-by: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Move the memset checks over to work against the statement. Also add
    checks for 0 and 1 used as lengths. Generally these indicate badly
    ordered parameters.

    Signed-off-by: Andy Whitcroft
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • When looking for a statement we currently run on through preprocessor
    commands. This means that a header file with just definitions is parsed
    over and over again combining all of the lines from the current line to
    the end of file leading to severe performance issues.

    Fix up context accumulation to track preprocessor commands and stop when
    reaching the end of them. At the same time vastly simplify the #define
    handling.

    Signed-off-by: Andy Whitcroft
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • Add a warn for not using __printf.

    Signed-off-by: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • email header lines can look like signature tags. It's valid to have
    multiple email recipients on a single line but not valid to have multiple
    signatures on a single line.

    Validate signatures only when not in the email headers.

    Clear the $in_commit_log flag when the patch filename appears.

    Add '-' to the valid chars in a message header for headers
    like "Message-Id:" and "In-Reply-To:".

    Signed-off-by: Joe Perches
    Reported-by: Julia Lawall
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

07 Nov, 2011

1 commit


01 Nov, 2011

2 commits


15 Sep, 2011

2 commits


31 Aug, 2011

1 commit

  • Usage of these flags has been deprecated for nearly 4 years by:

    commit f77bf01425b11947eeb3b5b54685212c302741b8
    Author: Sam Ravnborg
    Date: Mon Oct 15 22:25:06 2007 +0200

    kbuild: introduce ccflags-y, asflags-y and ldflags-y

    Moreover, these flags (at least EXTRA_CFLAGS) have been documented for command
    line use. By default, gmake(1) do not override command line setting, so this is
    likely to result in build failure or unexpected behavior.

    Warn about their introduction in Makefile or Kbuild files.

    Cc: Sam Ravnborg
    Cc: Andy Whitcroft
    Signed-off-by: Arnaud Lacombe
    Signed-off-by: Michal Marek

    Arnaud Lacombe
     

26 Aug, 2011

1 commit


26 Jul, 2011

7 commits

  • Previous behavior allowed only alphabetic prefixes like pr_info to exceed
    the 80 column line length limit.

    ath6kl wants to add a digit into the prefix, so allow numbers as well as
    digits in the _ printks.

    __ratelimited and __once and WARN_RATELIMIT
    and WARN_ONCE may now exceed 80 cols.

    Add missing _printk type for completeness.

    Signed-off-by: Joe Perches
    Cc: Andy Whitcroft
    Cc: Kalle Valo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Some patches are sent in using ISO-8859 or even Windows codepage 1252.

    Make checkpatch accept these by default and only emit the "Invalid UTF-8"
    message when using --strict.

    Signed-off-by: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Some users would like the ability to not emit some of the messages that
    checkpatch produces. This can make it easier to use checkpatch in other
    projects and integrate into scm hook scripts.

    Add command line option to "--ignore" various message types. Add option
    --show-types to emit the "type" of each message. Categorize all ERROR,
    WARN and CHK messages with types.

    Add optional .checkpatch.conf file to store default options.
    3 paths are searched for .checkpatch.conf
    . customized per-tree configurations
    $HOME user global configuration when per-tree configs don't exist
    ./scripts lk defaults to override script
    The .conf file can contain any valid command-line argument and
    the contents are prepended to any additional command line arguments.
    Multiple lines may be used, blank lines are ignored, # is a comment.

    Update "false positive" output for readability.

    Update version to 0.32

    Signed-off-by: Joe Perches
    Acked-by: Mike Frysinger
    Cc: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Prefer the use of __aligned(size) over __attribute__((__aligned___(size)))

    Link: http://lkml.kernel.org/r/20110609094526.1571774c.akpm@linux-foundation.org

    Suggested-by: Andrew Morton
    Signed-off-by: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Signatures have many forms and can sometimes cause problems if not in the
    correct format when using git send-email or quilt.

    Try to verify the signature tags and email addresses to use the generally
    accepted "Signed-off-by: Full Name " form.

    Original idea by Anish Kumar

    Signed-off-by: Joe Perches
    Cc: Anish Kumar
    Cc: Nick Bowler
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Fix "need consistent spacing around '*'" error after a __rcu sparse
    annotation which was caused by the missing __rcu entry in the
    checkpatch.pl internal list of sparse keywords.

    Signed-off-by: Sven Eckelmann
    Cc: Andy Whitcroft
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sven Eckelmann
     
  • A common issue with min() or max() is using a cast on one or both of the
    arguments when using min_t/max_t could be better.

    Add cast detection to uses of min/max and suggest an appropriate use of
    min_t or max_t instead.

    Caveat: This only works for min() or max() on a single line.
    It does not find min() or max() split across multiple lines.

    This does find:
    min((u32)foo, bar);
    But it does not find:
    max((unsigned long)foo,
    bar);

    Suggested-by: Andrew Morton
    Signed-off-by: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

16 Jun, 2011

1 commit


25 May, 2011

3 commits


31 Mar, 2011

1 commit


23 Mar, 2011

3 commits

  • Because the second and third arguments of memset have the same type, it
    turns out to be really easy to mix them up.

    This bug comes up time after time, so checkpatch should really be checking
    for it at patch submission time.

    Signed-off-by: Dave Jones
    Cc: Steven Rostedt
    Cc: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dave Jones
     
  • If you run checkpatch against multiple patches, and one of them has a
    whitespace issue which can be helped via a script (rpt_cleaners), you will
    see the same NOTE over and over for all subsequent patches. It makes it
    seem like those patches also have whitespace problems when in reality,
    there's only one or two bad apples.

    So reset rpt_cleaners back to 0 after we've issued the note so that it
    only shows up near the patch with the actual problems.

    Signed-off-by: Mike Frysinger
    Cc: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Frysinger
     
  • 1. simple_strto*() do not contain overflow checks and crufty,
    libc way to indicate failure.
    2. strict_strto*() also do not have overflow checks but the name and
    comments pretend they do.
    3. Both families have only "long long" and "long" variants,
    but users want strtou8()
    4. Both "simple" and "strict" prefixes are wrong:
    Simple doesn't exactly say what's so simple, strict should not exist
    because conversion should be strict by default.

    The solution is to use "k" prefix and add convertors for more types.
    Enter
    kstrtoull()
    kstrtoll()
    kstrtoul()
    kstrtol()
    kstrtouint()
    kstrtoint()

    kstrtou64()
    kstrtos64()
    kstrtou32()
    kstrtos32()
    kstrtou16()
    kstrtos16()
    kstrtou8()
    kstrtos8()

    Include runtime testsuite (somewhat incomplete) as well.

    strict_strto*() become deprecated, stubbed to kstrto*() and
    eventually will be removed altogether.

    Use kstrto*() in code today!

    Note: on some archs _kstrtoul() and _kstrtol() are left in tree, even if
    they'll be unused at runtime. This is temporarily solution,
    because I don't want to hardcode list of archs where these
    functions aren't needed. Current solution with sizeof() and
    __alignof__ at least always works.

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

27 Jan, 2011

1 commit


14 Jan, 2011

2 commits