07 Aug, 2014

33 commits

  • Merge incoming from Andrew Morton:
    - Various misc things.
    - arch/sh updates.
    - Part of ocfs2. Review is slow.
    - Slab updates.
    - Most of -mm.
    - printk updates.
    - lib/ updates.
    - checkpatch updates.

    * emailed patches from Andrew Morton : (226 commits)
    checkpatch: update $declaration_macros, add uninitialized_var
    checkpatch: warn on missing spaces in broken up quoted
    checkpatch: fix false positives for --strict "space after cast" test
    checkpatch: fix false positive MISSING_BREAK warnings with --file
    checkpatch: add test for native c90 types in unusual order
    checkpatch: add signed generic types
    checkpatch: add short int to c variable types
    checkpatch: add for_each tests to indentation and brace tests
    checkpatch: fix brace style misuses of else and while
    checkpatch: add --fix option for a couple OPEN_BRACE misuses
    checkpatch: use the correct indentation for which()
    checkpatch: add fix_insert_line and fix_delete_line helpers
    checkpatch: add ability to insert and delete lines to patch/file
    checkpatch: add an index variable for fixed lines
    checkpatch: warn on break after goto or return with same tab indentation
    checkpatch: emit a warning on file add/move/delete
    checkpatch: add test for commit id formatting style in commit log
    checkpatch: emit fewer kmalloc_array/kcalloc conversion warnings
    checkpatch: improve "no space after cast" test
    checkpatch: allow multiple const * types
    ...

    Linus Torvalds
     
  • Pull trivial tree changes from Jiri Kosina:
    "Summer edition of trivial tree updates"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (23 commits)
    doc: fix two typos in watchdog-api.txt
    irq-gic: remove file name from heading comment
    MAINTAINERS: Add miscdevice.h to file list for char/misc drivers.
    scsi: mvsas: mv_sas.c: Fix for possible null pointer dereference
    doc: replace "practise" with "practice" in Documentation
    befs: remove check for CONFIG_BEFS_RW
    scsi: doc: fix 'SCSI_NCR_SETUP_MASTER_PARITY'
    drivers/usb/phy/phy.c: remove a leading space
    mfd: fix comment
    cpuidle: fix comment
    doc: hpfall.c: fix missing null-terminate after strncpy call
    usb: doc: hotplug.txt code typos
    kbuild: fix comment in Makefile.modinst
    SH: add proper prompt to SH_MAGIC_PANEL_R2_VERSION
    ARM: msm: Remove MSM_SCM
    crypto: Remove MPILIB_EXTRA
    doc: CN: remove dead link, kerneltrap.org no longer works
    media: update reference, kerneltrap.org no longer works
    hexagon: update reference, kerneltrap.org no longer works
    doc: LSM: update reference, kerneltrap.org no longer works
    ...

    Linus Torvalds
     
  • Using uninitialized_var reports a false positive for "Missing blank line
    after declarations".

    Fix it by adding uninitialized_var to the $declaration_macros exceptions
    list.

    Move the macro list after $Type is declared.

    Add optional prefixes to DECLARE_ and DEFINE_
    macro declarations to allow forms like:
    MLX4_DECLARE_DOORBELL_LOCK

    Signed-off-by: Joe Perches
    Reported-by: Dotan Barak
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Checkpatch already complains when people break up quoted strings but
    it's still pretty common. One mistake that people often make is they
    leave out the space character between the two strings.

    This check adds around 450 new warnings and has a low rate of false
    positives.

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

    Dan Carpenter
     
  • Commit 89da401f6cff ("checkpatch: improve "no space after cast" test")
    in -next improved the cast test for non pointer types, but also
    introduced false positives for some types of static inlines.

    Add a test for an open brace to the exclusions to avoid these false
    positives.

    Signed-off-by: Joe Perches
    Reported-by: Hartley Sweeten
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Using --file mode can give false positives with MISSING_BREAK
    fall-through warnings on simple but long multiple consecutive case
    statements.

    Look for all lines before a case statement for a switch or a statement
    when using --file mode.

    Fix a misspelling of preceded while there.

    Signed-off-by: Joe Perches
    Reported-by: Lee Jones
    Acked-by: Lee Jones
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • c90 section "6.7.2 Type Specifiers" says:
    "type specifiers may occur in any order"

    That means that:
    short int is the same as int short
    unsigned short int is the same as int unsigned short
    etc...

    checkpatch currently parses only a subset of these allowed types.

    For instance: "unsigned short" and "signed short" are found by
    checkpatch as a specific type, but none of the or "int short" or "int
    signed short" variants are found.

    Add another table for the "kernel style misordered" variants.

    Add this misordered table to the findable types.

    Warn when the misordered style is used.

    This improves the "Missing a blank line after declarations" test as it
    depends on the correct parsing of the $Declare variable which looks for
    "$Type $Ident;" (ie: declarations like "int foo;").

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

    Joe Perches
     
  • Current generic types are unsigned or unspecified. Add signed to the
    types.

    Reorder the types to find the longest match first.

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

    Joe Perches
     
  • short int is one of the 6.7.2 c90 types.
    Find it appropriately.

    This fixes a defect in checkpatch where it suggests that a line break
    after declaration is required using an input like:

    int foo;
    short int bar;

    Without this change, it warns on the short int line.

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

    Joe Perches
     
  • All the various for_each loop macros were not tested for trailing brace
    on the following lines and for bad indentation.

    Add them.

    Signed-off-by: Joe Perches
    Reported-by: Greg KH
    Cc: Andy Whitcroft
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Add --fix corrections for ELSE_AFTER_BRACE and WHILE_AFTER_BRACE
    misuses.

    if (x) {
    ...
    }
    else {
    ...
    }

    is corrected to

    if (x) {
    ...
    } else {
    ...
    }

    and

    do {
    ...
    }
    while (x);

    is corrected to

    do {
    ...
    } while (x);

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

    Joe Perches
     
  • Style misuses of these types are corrected:

    typedef struct foo
    {
    int bar;
    };

    int foo(int bar) { return bar+1;
    }

    int foo(int bar) {
    return bar+1;
    }

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

    Joe Perches
     
  • I copied the which subroutine from get_maintainer.pl.

    Unfortunately, get_maintainer uses a 4 space indentation so use the
    proper tab indentation instead.

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

    Joe Perches
     
  • Neaten the uses of patch/file line insertions or deletions. Hide the
    mechanism used.

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

    Joe Perches
     
  • This can be valuable to insert or delete blank lines as well as fix
    misplaced brace or else uses.

    Store indexes of lines to be added/deleted and the new lines.

    When creating the --fix file, insert or delete the appropriate lines and
    update the patch range information.

    Signed-off-by: Joe Perches
    Cc: Andy Whitcroft
    Cc: Dan Carpenter
    Cc: Josh Triplett
    Cc: Greg Kroah-Hartman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Make the fix code a bit easier to read.

    This should also start to allow an easier mechanism to insert/delete
    lines eventually too.

    Signed-off-by: Joe Perches
    Cc: Andy Whitcroft
    Cc: Dan Carpenter
    Cc: Josh Triplett
    Cc: Greg Kroah-Hartman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Using break; after a goto or return is unnecessary so emit a warning
    when the break is at the same indent level.

    So this emits a warning on:

    switch (foo) {
    case 1:
    goto err;
    break;
    }

    but not on:

    switch (foo) {
    case 1:
    if (bar())
    goto err;
    break;
    }

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

    Joe Perches
     
  • Whenever files are added, moved, or deleted, the MAINTAINERS file
    patterns can be out of sync or outdated.

    To try to keep MAINTAINERS more up-to-date, add a one-time warning
    whenever a patch does any of those.

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

    Joe Perches
     
  • Commit logs have various forms of commit id references.

    Try to standardize on a 12 character long lower case commit id along
    with a description of parentheses and the quoted subject line.

    ie: commit 0123456789ab ("commit description")

    If git and a git tree exists, look up the commit id and emit the
    appropriate line as part of the message.

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

    Joe Perches
     
  • Avoid matching allocs that appear to be known small multiplications of a
    sizeof with a constant because gcc as of 4.8 cannot optimize the code in
    a calloc() exactly the same way as an alloc().

    Look for numeric constants or what appear to be upper case only macro
    #defines.

    Signed-off-by: Joe Perches
    Reported-by: Theodore Ts'o
    Original-patch-by: Fabian Frederick
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • This --strict test previously worked only for what appeared to be cast
    to pointer types.

    Make it work for all casts.

    Also, there's no reason to show the previous line for this type of
    message, so don't.

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

    Joe Perches
     
  • checkpatch's $Type variable does not match declarations of multiple
    const * types.

    This can produce false positives for things like:

    $ ./scripts/checkpatch.pl -f drivers/staging/comedi/comedidev.h
    WARNING: Missing a blank line after declarations
    #60: FILE: drivers/staging/comedi/comedidev.h:60:
    + const struct comedi_lrange *range_table;
    + const struct comedi_lrange *const *range_table_list;

    Fix the $Type variable to support matching multiple "* const" uses.

    Signed-off-by: Joe Perches
    Reported-by: Hartley Sweeten
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Parentheses around &(foo->bar) and *(foo->bar) are unnecessary. Emit a
    --strict only message on these uses.

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

    Joe Perches
     
  • Editing Kconfig dependencies can emit unnecessary messages about missing
    or too short help entries.

    Only emit the message when adding help sections to Kconfig files.

    Signed-off-by: Joe Perches
    Reported-by: Jean Delvare
    Tested-by: Jean Delvare
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Make it consistent with the other missing or multiple blank line tests.

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

    Joe Perches
     
  • Multiple consecutive blank lines waste screen space. Emit a --strict
    only message with these blank lines.

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

    Joe Perches
     
  • Add a --strict test asking for a blank line after
    function/struct/union/enum declarations.

    Allow exceptions for several attributes and macro uses.

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

    Joe Perches
     
  • This might help a kernel hacker think twice before blindly adding a
    newline.

    Signed-off-by: Rasmus Villemoes
    Acked-by: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • There are some patches created by git format-patch that when scanned by
    checkpatch report errors on lines like

    To: address.tld

    This is a checkpatch false positive.

    Improve the logic a bit to ignore folded email headers to avoid emitting
    these messages.

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

    Joe Perches
     
  • Add a function pointer declaration check to the test for blank line
    needed after declarations.

    Signed-off-by: Joe Perches
    Reported-by: Bruce W Allan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • A single escaped constant char is not a complex macro.

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

    Joe Perches
     
  • Using an else following a break or return can unnecessarily indent code
    blocks.

    ie:
    for (i = 0; i < 100; i++) {
    int foo = bar();
    if (foo < 1)
    break;
    else
    usleep(1);
    }

    is generally better written as:

    for (i = 0; i < 100; i++) {
    int foo = bar();
    if (foo < 1)
    break;
    usleep(1);
    }

    Warn when a bare else statement is preceded by a break or return
    indented 1 tab more than the else.

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

    Joe Perches
     
  • Logging messages that show some type of "out of memory" error are
    generally unnecessary as there is a generic message and a stack dump
    done by the memory subsystem.

    These messages generally increase kernel size without much added value.

    Emit a warning on these types of messages.

    This test looks for any inserted message function, then looks at the
    previous line for an "if (!foo)" or "if (foo == NULL)" test and then
    looks at the preceding statement for an allocation function like "foo =
    kmalloc()"

    ie: this code matches:

    foo = kmalloc();
    if (foo == NULL) {
    printk("Out of memory\n");
    return -ENOMEM;
    }

    This test is very crude and incomplete.

    This test can miss quite a lot of of OOM messages that do not have this
    specific form.

    ie: this code does not match:

    foo = kmalloc();
    if (!foo) {
    rtn = -ENOMEM;
    printk("Out of memory!\n");
    goto out;
    }

    This test could also be a false positive when the logging message itself
    does not specify anything about memory, but I did not find any false
    positives in my limited testing.

    spatch could be a better solution but correctness seems non-trivial for
    that tool too.

    Signed-off-by: Joe Perches
    Acked-by: Dan Carpenter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

06 Aug, 2014

1 commit

  • Pull security subsystem updates from James Morris:
    "In this release:

    - PKCS#7 parser for the key management subsystem from David Howells
    - appoint Kees Cook as seccomp maintainer
    - bugfixes and general maintenance across the subsystem"

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (94 commits)
    X.509: Need to export x509_request_asymmetric_key()
    netlabel: shorter names for the NetLabel catmap funcs/structs
    netlabel: fix the catmap walking functions
    netlabel: fix the horribly broken catmap functions
    netlabel: fix a problem when setting bits below the previously lowest bit
    PKCS#7: X.509 certificate issuer and subject are mandatory fields in the ASN.1
    tpm: simplify code by using %*phN specifier
    tpm: Provide a generic means to override the chip returned timeouts
    tpm: missing tpm_chip_put in tpm_get_random()
    tpm: Properly clean sysfs entries in error path
    tpm: Add missing tpm_do_selftest to ST33 I2C driver
    PKCS#7: Use x509_request_asymmetric_key()
    Revert "selinux: fix the default socket labeling in sock_graft()"
    X.509: x509_request_asymmetric_keys() doesn't need string length arguments
    PKCS#7: fix sparse non static symbol warning
    KEYS: revert encrypted key change
    ima: add support for measuring and appraising firmware
    firmware_class: perform new LSM checks
    security: introduce kernel_fw_from_file hook
    PKCS#7: Missing inclusion of linux/err.h
    ...

    Linus Torvalds
     

05 Aug, 2014

1 commit

  • Pull driver core updates from Greg KH:
    "Here's the big driver-core pull request for 3.17-rc1.

    Largest thing in here is the dma-buf rework and fence code, that
    touched many different subsystems so it was agreed it should go
    through this tree to handle merge issues. There's also some firmware
    loading updates, as well as tests added, and a few other tiny changes,
    the changelog has the details.

    All have been in linux-next for a long time"

    * tag 'driver-core-3.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (32 commits)
    ARM: imx: Remove references to platform_bus in mxc code
    firmware loader: Fix _request_firmware_load() return val for fw load abort
    platform: Remove most references to platform_bus device
    test: add firmware_class loader test
    doc: fix minor typos in firmware_class README
    staging: android: Cleanup style issues
    Documentation: devres: Sort managed interfaces
    Documentation: devres: Add devm_kmalloc() et al
    fs: debugfs: remove trailing whitespace
    kernfs: kernel-doc warning fix
    debugfs: Fix corrupted loop in debugfs_remove_recursive
    stable_kernel_rules: Add pointer to netdev-FAQ for network patches
    driver core: platform: add device binding path 'driver_override'
    driver core/platform: remove unused implicit padding in platform_object
    firmware loader: inform direct failure when udev loader is disabled
    firmware: replace ALIGN(PAGE_SIZE) by PAGE_ALIGN
    firmware: read firmware size using i_size_read()
    firmware loader: allow disabling of udev as firmware loader
    reservation: add suppport for read-only access using rcu
    reservation: update api and add some helpers
    ...

    Conflicts:
    drivers/base/platform.c

    Linus Torvalds
     

22 Jul, 2014

1 commit


19 Jul, 2014

1 commit


17 Jul, 2014

1 commit


13 Jul, 2014

1 commit

  • Object-like macros are different than function-like macros:
    https://gcc.gnu.org/onlinedocs/cpp/Object-like-Macros.html
    https://gcc.gnu.org/onlinedocs/cpp/Function-like-Macros.html

    They are not parsed correctly, generating invalid intermediate
    files (xmls) for cases like:
    #define BIT_MASK (0xFF << BIT_SHIFT)
    where "OxFF <
    Signed-off-by: Randy Dunlap
    Signed-off-by: Linus Torvalds

    Horia Geanta
     

09 Jul, 2014

1 commit