summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* mm: thp: fix pmd_bad() triggering in code paths holding mmap_sem read modeAndrea Arcangeli2012-03-219-10/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some cases it may happen that pmd_none_or_clear_bad() is called with the mmap_sem hold in read mode. In those cases the huge page faults can allocate hugepmds under pmd_none_or_clear_bad() and that can trigger a false positive from pmd_bad() that will not like to see a pmd materializing as trans huge. It's not khugepaged causing the problem, khugepaged holds the mmap_sem in write mode (and all those sites must hold the mmap_sem in read mode to prevent pagetables to go away from under them, during code review it seems vm86 mode on 32bit kernels requires that too unless it's restricted to 1 thread per process or UP builds). The race is only with the huge pagefaults that can convert a pmd_none() into a pmd_trans_huge(). Effectively all these pmd_none_or_clear_bad() sites running with mmap_sem in read mode are somewhat speculative with the page faults, and the result is always undefined when they run simultaneously. This is probably why it wasn't common to run into this. For example if the madvise(MADV_DONTNEED) runs zap_page_range() shortly before the page fault, the hugepage will not be zapped, if the page fault runs first it will be zapped. Altering pmd_bad() not to error out if it finds hugepmds won't be enough to fix this, because zap_pmd_range would then proceed to call zap_pte_range (which would be incorrect if the pmd become a pmd_trans_huge()). The simplest way to fix this is to read the pmd in the local stack (regardless of what we read, no need of actual CPU barriers, only compiler barrier needed), and be sure it is not changing under the code that computes its value. Even if the real pmd is changing under the value we hold on the stack, we don't care. If we actually end up in zap_pte_range it means the pmd was not none already and it was not huge, and it can't become huge from under us (khugepaged locking explained above). All we need is to enforce that there is no way anymore that in a code path like below, pmd_trans_huge can be false, but pmd_none_or_clear_bad can run into a hugepmd. The overhead of a barrier() is just a compiler tweak and should not be measurable (I only added it for THP builds). I don't exclude different compiler versions may have prevented the race too by caching the value of *pmd on the stack (that hasn't been verified, but it wouldn't be impossible considering pmd_none_or_clear_bad, pmd_bad, pmd_trans_huge, pmd_none are all inlines and there's no external function called in between pmd_trans_huge and pmd_none_or_clear_bad). if (pmd_trans_huge(*pmd)) { if (next-addr != HPAGE_PMD_SIZE) { VM_BUG_ON(!rwsem_is_locked(&tlb->mm->mmap_sem)); split_huge_page_pmd(vma->vm_mm, pmd); } else if (zap_huge_pmd(tlb, vma, pmd, addr)) continue; /* fall through */ } if (pmd_none_or_clear_bad(pmd)) Because this race condition could be exercised without special privileges this was reported in CVE-2012-1179. The race was identified and fully explained by Ulrich who debugged it. I'm quoting his accurate explanation below, for reference. ====== start quote ======= mapcount 0 page_mapcount 1 kernel BUG at mm/huge_memory.c:1384! At some point prior to the panic, a "bad pmd ..." message similar to the following is logged on the console: mm/memory.c:145: bad pmd ffff8800376e1f98(80000000314000e7). The "bad pmd ..." message is logged by pmd_clear_bad() before it clears the page's PMD table entry. 143 void pmd_clear_bad(pmd_t *pmd) 144 { -> 145 pmd_ERROR(*pmd); 146 pmd_clear(pmd); 147 } After the PMD table entry has been cleared, there is an inconsistency between the actual number of PMD table entries that are mapping the page and the page's map count (_mapcount field in struct page). When the page is subsequently reclaimed, __split_huge_page() detects this inconsistency. 1381 if (mapcount != page_mapcount(page)) 1382 printk(KERN_ERR "mapcount %d page_mapcount %d\n", 1383 mapcount, page_mapcount(page)); -> 1384 BUG_ON(mapcount != page_mapcount(page)); The root cause of the problem is a race of two threads in a multithreaded process. Thread B incurs a page fault on a virtual address that has never been accessed (PMD entry is zero) while Thread A is executing an madvise() system call on a virtual address within the same 2 MB (huge page) range. virtual address space .---------------------. | | | | .-|---------------------| | | | | | |<-- B(fault) | | | 2 MB | |/////////////////////|-. huge < |/////////////////////| > A(range) page | |/////////////////////|-' | | | | | | '-|---------------------| | | | | '---------------------' - Thread A is executing an madvise(..., MADV_DONTNEED) system call on the virtual address range "A(range)" shown in the picture. sys_madvise // Acquire the semaphore in shared mode. down_read(&current->mm->mmap_sem) ... madvise_vma switch (behavior) case MADV_DONTNEED: madvise_dontneed zap_page_range unmap_vmas unmap_page_range zap_pud_range zap_pmd_range // // Assume that this huge page has never been accessed. // I.e. content of the PMD entry is zero (not mapped). // if (pmd_trans_huge(*pmd)) { // We don't get here due to the above assumption. } // // Assume that Thread B incurred a page fault and .---------> // sneaks in here as shown below. | // | if (pmd_none_or_clear_bad(pmd)) | { | if (unlikely(pmd_bad(*pmd))) | pmd_clear_bad | { | pmd_ERROR | // Log "bad pmd ..." message here. | pmd_clear | // Clear the page's PMD entry. | // Thread B incremented the map count | // in page_add_new_anon_rmap(), but | // now the page is no longer mapped | // by a PMD entry (-> inconsistency). | } | } | v - Thread B is handling a page fault on virtual address "B(fault)" shown in the picture. ... do_page_fault __do_page_fault // Acquire the semaphore in shared mode. down_read_trylock(&mm->mmap_sem) ... handle_mm_fault if (pmd_none(*pmd) && transparent_hugepage_enabled(vma)) // We get here due to the above assumption (PMD entry is zero). do_huge_pmd_anonymous_page alloc_hugepage_vma // Allocate a new transparent huge page here. ... __do_huge_pmd_anonymous_page ... spin_lock(&mm->page_table_lock) ... page_add_new_anon_rmap // Here we increment the page's map count (starts at -1). atomic_set(&page->_mapcount, 0) set_pmd_at // Here we set the page's PMD entry which will be cleared // when Thread A calls pmd_clear_bad(). ... spin_unlock(&mm->page_table_lock) The mmap_sem does not prevent the race because both threads are acquiring it in shared mode (down_read). Thread B holds the page_table_lock while the page's map count and PMD table entry are updated. However, Thread A does not synchronize on that lock. ====== end quote ======= [akpm@linux-foundation.org: checkpatch fixes] Reported-by: Ulrich Obergfell <uobergfe@redhat.com> Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Cc: Mel Gorman <mgorman@suse.de> Cc: Hugh Dickins <hughd@google.com> Cc: Dave Jones <davej@redhat.com> Acked-by: Larry Woodman <lwoodman@redhat.com> Acked-by: Rik van Riel <riel@redhat.com> Cc: <stable@vger.kernel.org> [2.6.38+] Cc: Mark Salter <msalter@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Merge tag 'hwmon-for-linus' of ↵Linus Torvalds2012-03-21129-6219/+8581
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Pull hwmon changes for v3.4 from Guenter Roeck: "Mostly cleanup. No new drivers this time around, but support for several chips added to existing drivers: TPS40400, TPS40422, MTD040, MAX34446, ZL9101M, ZL9117M, and LM96080. Also, added watchdog support for SCH56xx, and additional attributes for a couple of drivers." * tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (137 commits) hwmon: (sch56xx) Add support for the integrated watchdog (v2) hwmon: (w83627ehf) Add support for temperature offset registers hwmon: (jc42) Remove unnecessary device IDs hwmon: (zl6100) Add support for ZL9101M and ZL9117M hwmon: (adm1275) Add support for ADM1075 hwmon: (max34440) Add support for MAX34446 hwmon: (pmbus) Add more virtual registers hwmon: (pmbus) Add support for Lineage Power MDT040 hwmon: (pmbus) Add support for TI TPS40400 and TPS40422 hwmon: (max34440) Add support for 'lowest' output voltage attribute hwmon: (jc42) Convert to use devm_kzalloc hwmon: (max16065) Convert to use devm_kzalloc hwmon: (smm665) Convert to use devm_kzalloc hwmon: (ltc4261) Convert to use devm_kzalloc hwmon: (pmbus) Simplify remove functions hwmon: (pmbus) Convert pmbus drivers to use devm_kzalloc hwmon: (lineage-pem) Convert to use devm_kzalloc hwmon: (hwmon-vid) Fix checkpatch issues hwmon: (hwmon-vid) Add new entries to VRM model table hwmon: (lm80) Add detection of NatSemi/TI LM96080 ...
| * hwmon: (sch56xx) Add support for the integrated watchdog (v2)Hans de Goede2012-03-207-7/+558
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for the watchdog integrated into the SMSC SCH5627 and SCH5636 superio-s. Since the watchdog is part of the hwmon logical device and thus shares ioports with it, the watchdog driver is integrated into the existing hwmon drivers for these. Note that this version of the watchdog support for sch56xx superio-s implements the watchdog chardev interface itself, rather then relying on the recently added watchdog core / watchdog_dev. This is done because currently some needed functionality is missing from watchdog_dev, as soon as this functionality is added (which is being discussed on the linux-watchdog mailinglist), I'll convert this driver over to using watchdog_dev. Signed-off-by: Hans de Goede <hdegoede@redhat.com> [guenter.roeck@ericsson.com: Added missing linux/slab.h include] Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
| * hwmon: (w83627ehf) Add support for temperature offset registersGuenter Roeck2012-03-181-0/+73
| | | | | | | | | | | | | | | | Add support for temperature offset registers for CPUTIN, SYSTIN, and AUXTIN temperatures. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Acked-by: Jean Delvare <khali@linux-fr.org>
| * hwmon: (jc42) Remove unnecessary device IDsGuenter Roeck2012-03-182-48/+9
| | | | | | | | | | | | | | | | | | | | We don't really use or need separate device IDs for the various JC42.4 compliant chips, so remove them and just stick with jc42. Also update a datasheet references for SE98A, STTS424, and STTS424E02. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
| * hwmon: (zl6100) Add support for ZL9101M and ZL9117MGuenter Roeck2012-03-183-4/+15
| | | | | | | | | | | | | | ZL9101M and ZL9117M are compatible to ZL6100. Add support to the zl6100 driver. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
| * hwmon: (adm1275) Add support for ADM1075Guenter Roeck2012-03-183-13/+109
| | | | | | | | Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (max34440) Add support for MAX34446Guenter Roeck2012-03-183-7/+138
| | | | | | | | Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (pmbus) Add more virtual registersGuenter Roeck2012-03-182-29/+54
| | | | | | | | | | | | | | | | | | | | Add PMBUS_VIRT_READ_TEMP_AVG, PMBUS_VIRT_READ_TEMP2_AVG, PMBUS_VIRT_READ_POUT_AVG, PMBUS_VIRT_READ_POUT_MAX, and PMBUS_VIRT_RESET_POUT_HISTORY. We'll need those for MAX34446. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (pmbus) Add support for Lineage Power MDT040Guenter Roeck2012-03-183-2/+5
| | | | | | | | | | | | | | MDT040 is supported by the generic PMBus driver. Add device ID and reference to datasheet. Also mention Lineage Power device support in Kconfig. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (pmbus) Add support for TI TPS40400 and TPS40422Guenter Roeck2012-03-183-1/+9
| | | | | | | | | | | | | | TPS40400 and TPS40422 are supported by the generic PMBus driver. Add device IDs and data sheet references. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (max34440) Add support for 'lowest' output voltage attributeGuenter Roeck2012-03-182-0/+10
| | | | | | | | | | | | | | | | MAX34440 and compatibles support reporting the lowest measured output voltage. Add support for it. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
| * hwmon: (jc42) Convert to use devm_kzallocGuenter Roeck2012-03-181-35/+25
| | | | | | | | | | | | | | | | Marginally less code and eliminate the possibility of memory leaks. Also replace new_client variable with client and introduce dev variable to make the code a bit easier to read. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (max16065) Convert to use devm_kzallocGuenter Roeck2012-03-181-16/+7
| | | | | | | | | | | | Marginally less code and eliminate the possibility of memory leaks. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (smm665) Convert to use devm_kzallocGuenter Roeck2012-03-181-9/+3
| | | | | | | | | | | | Marginally less code and eliminate the possibility of memory leaks. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (ltc4261) Convert to use devm_kzallocGuenter Roeck2012-03-181-11/+4
| | | | | | | | | | | | Marginally less code and eliminate the possibility of memory leaks. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (pmbus) Simplify remove functionsGuenter Roeck2012-03-1812-74/+13
| | | | | | | | | | | | | | | | | | Since devm_kzalloc() is now used to allocate driver memory, the client driver remove function has no purpose other than to call pmbus_do_remove(). This means we can get rid of it by redefining pmbus_do_remove() to use the same prototype, and pointing to it directly. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (pmbus) Convert pmbus drivers to use devm_kzallocGuenter Roeck2012-03-188-154/+56
| | | | | | | | | | | | Marginally less code and eliminate the possibility of memory leaks. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (lineage-pem) Convert to use devm_kzallocGuenter Roeck2012-03-181-7/+4
| | | | | | | | | | | | Marginally less code and eliminate the possibility of memory leaks. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (hwmon-vid) Fix checkpatch issuesGuenter Roeck2012-03-181-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed: ERROR: code indent should use tabs where possible ERROR: space required before the open parenthesis '(' WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable Not fixed (url): WARNING: line over 80 characters Not fixed (false positive): ERROR: Macros with complex values should be enclosed in parenthesis Cc: Rudolf Marek <r.marek@assembler.cz> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
| * hwmon: (hwmon-vid) Add new entries to VRM model tableGuenter Roeck2012-03-181-56/+53
| | | | | | | | | | | | | | | | | | | | | | The VRM model table was missing several Intel CPUs, resulting in wrong VRM table entries to be used for many recent CPUs. Update it. Also, use values from struct cpuinfo_x86 to retrieve CPU model information instead of re-calculating it locally. Cc: Rudolf Marek <r.marek@assembler.cz> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
| * hwmon: (lm80) Add detection of NatSemi/TI LM96080Jean Delvare2012-03-183-12/+45
| | | | | | | | | | | | | | | | | | | | | | Add detection of the National Semiconductor (now Texas Instruments) LM96080. It is functionally compatible with the LM80 but detection is completely different. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Frans Meulenbroeks <fransmeulenbroeks@gmail.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
| * hwmon: (lm87) Get rid of macro-generated functionsJean Delvare2012-03-181-193/+164
| | | | | | | | | | | | | | | | | | | | | | Use SENSORS_DEVICE_ATTR instead of DEVICE_ATTR for most attributes, so that the attribute number can be retrieved and it is no longer necessary to generate functions using macros. This shaves about 2 kB on the binary module size. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
| * hwmon: (lm87) Reorganize the codeJean Delvare2012-03-181-186/+165
| | | | | | | | | | | | | | | | | | Reorder functions and driver declaration to no longer need to forward-declare functions. Also rename new_client to just client everywhere for readability. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
| * hwmon: (applesmc) Silence uninitialized warningsHenrik Rydberg2012-03-181-2/+6
| | | | | | | | | | | | | | | | | | Some error paths do not set a result, leading to the (false) assumption that the value may be used uninitialized. Set results for those paths as well. Signed-off-by: Henrik Rydberg <rydberg@euromail.se> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
| * hwmon: (lm70) Fix: do not use assignment in if conditionGuenter Roeck2012-03-181-4/+6
| | | | | | | | | | | | | | Fix checkpatch issue: ERROR: do not use assignment in if condition Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (lm70) Register hwmon device after creating attribute files, and ↵Guenter Roeck2012-03-181-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | remove it first Register hwmon device as last operation in the probe function to ensure that all attribute files exist when accessed from user applications. Otherwise, there is a short time frame where the device is registered as hwmon device but sysfs attributes do not yet exist. This could result in applications erroneously not detecting attributes. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (w83l786ng) Fix multi-line commentsGuenter Roeck2012-03-181-32/+36
| | | | | | | | Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (w83l785ts) Fix multi-line commentsGuenter Roeck2012-03-181-6/+9
| | | | | | | | Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (w83781d) Fix: do not use assignment in if conditionGuenter Roeck2012-03-181-68/+72
| | | | | | | | | | | | | | | | | | Fix checkpatch issue: ERROR: do not use assignment in if condition Replace repeated calls to device_create_file() with calls to sysfs_create_group. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (w83781d) Fix multi-line commentsGuenter Roeck2012-03-181-80/+117
| | | | | | | | Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (smsc47b397) Fix multi-line commentsGuenter Roeck2012-03-181-30/+34
| | | | | | | | | | Cc: Mark M Hoffman <mhoffman@lightlink.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (pc87427) Fix multi-line commentsGuenter Roeck2012-03-181-27/+45
| | | | | | | | | | | | Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
| * hwmon: (max1668) Fix multi-line commentsGuenter Roeck2012-03-181-19/+19
| | | | | | | | Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (lm80) Fix multi-line commentsGuenter Roeck2012-03-181-13/+19
| | | | | | | | | | Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
| * hwmon: (emc2103) Fix multi-line commentsGuenter Roeck2012-03-181-23/+27
| | | | | | | | | | Cc: Steve Glendinning <steve.glendinning@smsc.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (adm1031) Fix multi-line commentsGuenter Roeck2012-03-181-27/+33
| | | | | | | | Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (adm1029) Fix multi-line commentsGuenter Roeck2012-03-181-8/+11
| | | | | | | | | | Cc: Corentin Labbe <corentin.labbe@geomatys.fr> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (w83627hf) Fix checkpatch issuesGuenter Roeck2012-03-181-90/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed: WARNING: simple_strtol is obsolete, use kstrtol instead WARNING: simple_strtoul is obsolete, use kstrtoul instead ERROR: do not use assignment in if condition Modify multi-line comments to follow Documentation/CodingStyle. Other checkpatch issues not fixed to reduce number of conflicts with pending rewrite as mfd driver. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (w83l786ng) Fix checkpatch issuesGuenter Roeck2012-03-181-33/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed: ERROR: code indent should use tabs where possible ERROR: do not use assignment in if condition ERROR: space required after that ',' (ctx:VxV) WARNING: braces {} are not necessary for single statement blocks WARNING: please, no space before tabs WARNING: please, no spaces at the start of a line WARNING: simple_strtol is obsolete, use kstrtol instead WARNING: simple_strtoul is obsolete, use kstrtoul instead WARNING: space prohibited between function name and open parenthesis '(' Not fixed (false positive): ERROR: Macros with complex values should be enclosed in parenthesis Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (w83793) Fix checkpatch issuesGuenter Roeck2012-03-181-181/+253
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed: ERROR: code indent should use tabs where possible ERROR: do not use assignment in if condition ERROR: space required after that ',' (ctx:VxV) WARNING: braces {} are not necessary for any arm of this statement WARNING: braces {} are not necessary for single statement blocks WARNING: simple_strtol is obsolete, use kstrtol instead WARNING: simple_strtoul is obsolete, use kstrtoul instead Modify multi-line comments to follow Documentation/CodingStyle. Also replaced "<constant> == <variable>" with "<variable> == <constant>". Translation was done with the following coccinelle script to limit risk. @@ identifier i; constant C; @@ <... - C == i + i == C ...> Not fixed (false positive): ERROR: Macros with complex values should be enclosed in parenthesis Cc: Rudolf Marek <r.marek@assembler.cz> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (w83792d) Fix checkpatch issuesGuenter Roeck2012-03-181-148/+229
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed: ERROR: code indent should use tabs where possible ERROR: do not use assignment in if condition ERROR: space prohibited after that open parenthesis '(' ERROR: space required after that ',' (ctx:VxV) ERROR: space required after that ',' (ctx:WxV) ERROR: spaces required around that ':' (ctx:VxE) ERROR: spaces required around that '<=' (ctx:VxV) ERROR: spaces required around that '<' (ctx:VxV) ERROR: spaces required around that '==' (ctx:VxV) ERROR: spaces required around that '=' (ctx:VxV) ERROR: spaces required around that '||' (ctx:VxV) ERROR: spaces required around that ':' (ctx:VxV) ERROR: spaces required around that '?' (ctx:VxV) WARNING: braces {} are not necessary for any arm of this statement WARNING: braces {} are not necessary for single statement blocks WARNING: line over 80 characters WARNING: simple_strtol is obsolete, use kstrtol instead WARNING: simple_strtoul is obsolete, use kstrtoul instead WARNING: space prohibited between function name and open parenthesis '(' Modify multi-line comments to follow Documentation/CodingStyle. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (vt1211) Fix: do not use assignment in if conditionGuenter Roeck2012-03-181-133/+94
| | | | | | | | | | | | | | | | | | | | Fix checkpatch issue: ERROR: do not use assignment in if condition Replace repeated calls to device_create_file() with calls to sysfs_create_group. Cc: Juerg Haefliger <juergh@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (vt1211) Fix checkpatch issuesGuenter Roeck2012-03-181-60/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed: ERROR: do not use assignment in if condition ERROR: switch and case should be at the same indent ERROR: trailing statements should be on next line WARNING: braces {} are not necessary for single statement blocks WARNING: simple_strtol is obsolete, use kstrtol instead Modify multi-line comments to follow Documentation/CodingStyle. Not fixed (false positive): ERROR: Macros with complex values should be enclosed in parenthesis Not all fixed (code complexity): ERROR: do not use assignment in if condition Cc: Juerg Haefliger <juergh@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (via686a) Fix checkpatch issuesGuenter Roeck2012-03-181-148/+207
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed: ERROR: do not use assignment in if condition ERROR: open brace '{' following function declarations go on the next line ERROR: space prohibited before that close parenthesis ')' ERROR: space required after that ',' (ctx:VxV) ERROR: spaces required around that '==' (ctx:VxV) ERROR: spaces required around that ':' (ctx:VxV) ERROR: spaces required around that '?' (ctx:VxV) ERROR: that open brace { should be on the previous line WARNING: line over 80 characters WARNING: simple_strtol is obsolete, use kstrtol instead WARNING: simple_strtoul is obsolete, use kstrtoul instead Modify multi-line comments to follow Documentation/CodingStyle. Not fixed (false positive): ERROR: Macros with multiple statements should be enclosed in a do - while loop Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (pc87360) Fix: do not use assignment in if conditionGuenter Roeck2012-03-181-71/+58
| | | | | | | | | | | | | | | | | | | | | | Fix checkpatch issue: ERROR: do not use assignment in if condition Replace repeated calls to device_create_file() with calls to sysfs_create_group. Cc: Jean Delvare <khali@linux-fr.org> Cc: Jim Cromie <jim.cromie@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (pc87360) Fix checkpatch issuesGuenter Roeck2012-03-181-144/+260
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed: ERROR: code indent should use tabs where possible ERROR: do not use assignment in if condition ERROR: "foo * bar" should be "foo *bar" ERROR: space required after that ',' (ctx:VxV) ERROR: spaces required around that ':' (ctx:VxE) ERROR: spaces required around that '==' (ctx:VxV) WARNING: braces {} are not necessary for single statement blocks WARNING: line over 80 characters WARNING: please, no space before tabs WARNING: please, no spaces at the start of a line WARNING: simple_strtol is obsolete, use kstrtol instead WARNING: simple_strtoul is obsolete, use kstrtoul instead Not or not all fixed (code complexity): ERROR: Macros with complex values should be enclosed in parenthesis ERROR: do not use assignment in if condition Cc: Jim Cromie <jim.cromie@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (max1619): Fix checkpatch issuesGuenter Roeck2012-03-181-7/+14
| | | | | | | | | | | | | | | | | | | | | | Fixed: ERROR: do not use assignment in if condition ERROR: trailing whitespace WARNING: line over 80 characters WARNING: please, no spaces at the start of a line WARNING: simple_strtol is obsolete, use kstrtol instead Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (lm85) Fix checkpatch issuesGuenter Roeck2012-03-181-130/+230
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed: ERROR: code indent should use tabs where possible ERROR: do not use assignment in if condition WARNING: simple_strtol is obsolete, use kstrtol instead WARNING: simple_strtoul is obsolete, use kstrtoul instead Modify multi-line comments to follow Documentation/CodingStyle. Also: s/#define^I/#define / Not fixed (false positive): ERROR: Macros with multiple statements should be enclosed in a do - while loop Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * hwmon: (lm78) Fix checkpatch issuesGuenter Roeck2012-03-181-74/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed: ERROR: code indent should use tabs where possible ERROR: do not use assignment in if condition ERROR: space prohibited before that close parenthesis ')' ERROR: space required after that ',' (ctx:VxV) ERROR: spaces required around that '<' (ctx:VxV) ERROR: spaces required around that '==' (ctx:VxV) ERROR: trailing statements should be on next line ERROR: trailing whitespace WARNING: simple_strtol is obsolete, use kstrtol instead WARNING: simple_strtoul is obsolete, use kstrtoul instead Modify multi-line comments to follow Documentation/CodingStyle. Not fixed (false positive): ERROR: Macros with multiple statements should be enclosed in a do - while loop Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
OpenPOWER on IntegriCloud