aboutsummaryrefslogtreecommitdiff
path: root/scripts
Commit message (Collapse)AuthorAgeFilesLines
* Fix version nameflar22016-11-221-2/+2
| | | | Signed-off-by: flar2 <asegaert@gmail.com>
* scripts/dtc/libfdt: add integer overflow checksvijay kumar2015-01-281-5/+22
| | | | | | | | | | | | | | | | | This patch applies the same changes in the original commit below to the dtc to keep both sources in sync. original commit: lib: fdt: add integer overflow checks added integer overflow checks to avoid buffer over reads/write while using the fdt header fields. CRs-fixed: 705078. Change-Id: I062ee9e0610eeeeea32dd95695b18aa9dbca06ea Bug: 19136881 Signed-off-by: Patrick Tjin <pattjin@google.com>
* Update copyright to The Linux FoundationDuy Truong2013-03-152-4/+4
| | | | | Change-Id: Ibead64ce2e901dede2ddd1b86088b88f2350ce92 Signed-off-by: Duy Truong <dtruong@codeaurora.org>
* USB: allow match on bInterfaceNumberBjørn Mork2013-03-151-1/+4
| | | | | | | | | | | | | | | | | | | | | From 81df2d594340dcb6d1a02191976be88a1ca8120c upstream. Some composite USB devices provide multiple interfaces with different functions, all using "vendor-specific" for class/subclass/protocol. Another OS use interface numbers to match the driver and interface. It seems these devices are designed with that in mind - using static interface numbers for the different functions. This adds support for matching against the bInterfaceNumber, allowing such devices to be supported without having to resort to testing against interface number whitelists and/or blacklists in the probe. Change-Id: I0f991e507d041bbe12aa87403b9c2e1f0de274c2 Signed-off-by: Bjørn Mork <bjorn@mork.no> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* checkpatch: Excuse reverts from "summary line over 75 characters" checkMatt Wagantall2013-03-071-2/+2
| | | | | | | | | | | | | Rather than forcing authors of reverts to truncate the summary line because the "Revert" prefix added pushes it over the character limit, excuse reverts from this rule. Change-Id: I395dfff3327e360ef935d4a685c38df6577e3867 Signed-off-by: Matt Wagantall <mattw@codeaurora.org> (cherry picked from commit 3c09aeb415d542b08257021992aadd965fcb3902) Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org> (cherry picked from commit 952824addcec8487b8c800b0ef18ede547711381)
* checkpatch: strlen and strcmp should not be bannedDavid Brown2013-02-271-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Software security is an important issue, in general, but it is especially important in Linux kernel code. Buffer overflows can have wide-reaching ramifications and can often be readily exploited to compromise the entire system. It is important for every developer to be aware of security issues while writing code. However, I've noticed a few "rules" about coding that are resulting in code that isn't any more secure, and has the disadvantage of obscuring what the code is doing. In most instances, the "corrected" code is actually wrong: we've traded a perceived lack of safety for incorrect behavior. These obfuscations also make this code more distant from upstream kernel standards. I'm only going to focus here on strcmp/strncmp and strlen/strnlen. I choose these two, because in the context of the kernel, it's not easy to make a general rule, such as "always use the 'n' variant". These function have different behavior, and the 'n' isn't just a blanket fix that makes them better. In many instances, the correct call is the plain variant (strcpy has a strlcpy variant which is usually helpful). Let's start with strlen/strnlen. size_t strlen(const char *); size_t strnlen(const char *, size_t); The strlen() function scans for a NUL byte within a string, and returns the number of characters that had to be skipped to get there. The strnlen() call is similar, but will stop after after a maximal number of characters, and return that result. This variant was intended for storing variable length strings in fixed-sized buffers, where the full-length case did not have a trailing NUL. This storage model is very uncommon, as is the use of strnlen(). The question becomes, what is the maximal length you should be giving to strnlen(). If the string is truly variable length (allocated and filled), there really isn't a meaningful value to use for this. The only time that a max length makes sense is when you have something like: char name[MAX_NAME_LENGTH]; but, in this case, strnlen() is still probably not what you want to be using. It would be safe to use, if you check the result, and if it is MAX_NAME_LENGTH, raise some kind of error case. If later code assumes there is a NUL at the end, there will still be a buffer overflow. In this case, it is much better to check the length before storing it in this field, and make sure there is room for the NUL. If the string is a constant, passing in a length doesn't make sense, since you would have to know the length of the string to check that. There is no safety issue with calling strlen() on a constant. So, the simple rule for strnlen()/strlen() is: - If the string doesn't have an obvious bound length, such as an allocated string, use strlen(). - If the string is a constant, use strlen(). - If there is a fixed buffer, strnlen() might make sense, but it is probably better to change the design to avoid these types of strings. The only case where strnlen really makes sense is when you have a string that is passed in from the user. In this case, it is very important to check the result, and if the length is at the maximum, return an error, and don't try to do any processing on the string. Moving on to strcmp/strncmp. These functions are similar, except that they take two string arguments, which gives a lot more combinations. int strcmp(const char *, const char *); int strncmp(const char *, const char *, size_t); These will walk both strings (at the same time), and stop when reaching the first difference between them. This means that they will never go further than the length of the shortest string being compared. As in strnlen, the max argument to strncmp sets a limit on the comparison. Similar to strnlen, the results are unusual when the limit is reached, but in a sense, even worse, since it may consider the strings equal without ever reaching the end of either. Looking over the 200 some uses of strncmp in the msm code, almost all of them do something akin to: strncmp(value, constant, strlen(constant)) If the call has added 1 to the 'strlen' result, the strncmp would just become an inefficient, but otherwise identical version of strcmp. However, without the +1, this compares the prefix of 'value' instead of the entire string. Only one instance of strncmp in the code appears to be intentionally checking for a prefix. The rest have changed a simple string compare into an unintentional prefix match. Because there are two strings, it is a little more complex to determine which to use, but it is very similar. It might seem that strncmp() would be useful for checking an unknown buffer (say from userspace). However, since strncmp()'s result doesn't distinguish between finding the end of the string, or hitting the max, there's no way to know. Some guidelines: - If one of the strings has a known bound length (such as a constant, or another string whose length has already been checked), AND this bound length is within the expected buffer of the other string, it is safe to use strcmp(). - Otherwise, you may need to use something like strnlen() to determine a maximum length before calling strcmp(). - strncmp() is useful to test a string for a prefix. No other uses make sense. To facilitate fixing these, remove strlen(), strcmp(), and strcasecmp() from the list of calls that are banned. Problems with these calls need to be caught at a higher level (such as review), and replacing them with the 'n' variants doesn't help anything. This will be followed by some patches that fixup the incorrect code introduced by this "ban". Change-Id: I77dfe1f2f58e8c951e4b38b23f4ec79f8209b1dc Signed-off-by: David Brown <davidb@codeaurora.org>
* checkpatch: add new message type stringSteve Muckle2013-02-271-22/+40
| | | | | | | | | Many messsages are missing the new message type parameter, which causes warning messages and a lack of the line number from the offending line in the patch. Change-Id: I69f2283c3dc27edd66fd2676c8be45664699dba6 Signed-off-by: Steve Muckle <smuckle@codeaurora.org>
* scripts/checkpatch.pl: fixupRohit Vaswani2013-02-201-23/+7
| | | | | Change-Id: I76a7f5fd446a9f40d8294f03d2c355273af59905 Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
* checkpatch: Check for unsafe string functionsOlav Haugan2013-02-201-2/+5
| | | | | | | | | | | | | | There are many string based functions that are unsafe to use. Some of the functions are unsafe to use because of the possibility of overflow while others cannot guarantee that the resultant string is NULL-terminated. Add check for these functions and log message indicating which safe functions can be used instead. Change-Id: Id305d98df241e3fd257529529739dcd4f3659186 Signed-off-by: Olav Haugan <ohaugan@codeaurora.org> (cherry picked from commit 665be0da353f69f85cb1acea19279adf6ccb5b52)
* checkpatch: recognize only specific tags when ending commit textSteve Muckle2013-02-201-1/+4
| | | | | | | | | | There are some very frequently used tags that checkpatch can look for as an ending to the commit text rather than using a pattern, which can generate false positives in the "no commit text" rule. Change-Id: I5b4400017b8273bcd9f5a59b3e28965c0062bef4 Signed-off-by: Steve Muckle <smuckle@codeaurora.org> (cherry picked from commit 336a3ae6253031d6a0de11882ac24a11f83d3323)
* checkpatch: require commit textSteve Muckle2013-02-201-5/+50
| | | | | | | | | | Commit text is almost always necessary to explain why a change is needed. Exceptions are rare enough that these can be granted through manual checkpatch overrides. Change-Id: I926b2276f717940c2fec77a6709fa3088b1bf0c3 Signed-off-by: Steve Muckle <smuckle@codeaurora.org> (cherry picked from commit d3b3b64c907dbf2244250fc4b389562f2efedee2)
* checkpatch: Add check for vreg_xxx api in opensource driversPankaj Kumar2013-02-201-0/+6
| | | | | | | | | | Vreg API implementation is deprecated. We are using Linux regulator framework now. Hence vreg API should not be used. Change-Id: I8e31dac66592d2d195d190b770a436e93206cf8b Signed-off-by: Pankaj Kumar <pakuma@codeaurora.org> (cherry picked from commit adfb933a24911e3514a2f1b6fe1b1a9151fec56d)
* checkpatch: Add check for gpiomux usage in msm board filesRohit Vaswani2013-02-201-0/+7
| | | | | | | | | | MSM has a board-*-gpiomux file where all the gpiomux configs reside. Warn if a non gpiomux board file tries to add gpiomux configs. The camera board file is an exception to this rule. Change-Id: Ibab190dcbd7ea78e7ca150142c68c5ae881e4e06 Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org> (cherry picked from commit 60d78bb9809e7d4d1c3dc1425cbfd9e649e87c1c)
* checkpatch: repair faulty executable-bit check.Gregory Bean2013-02-201-5/+3
| | | | | | | | | | | | | | Existing executable-bit test only works on second and later files contained in the patch. Correct this so all patches in the file are tested. Change-Id: Ie9363473f0d2fc067f9c593c86495d15e8e5d546 Signed-off-by: Gregory Bean <gbean@codeaurora.org> (cherry picked from commit 246e1f183dd3c2bfe63722ca5b207473cb9a0219) Conflicts: scripts/checkpatch.pl
* checkpatch: complain about the use of dsb().Gregory Bean2013-02-201-0/+6
| | | | | | | | Now that mb() does what we want, dsb() should be discouraged. Change-Id: Ib8fe8f44f669753c3d91fac3c6e598e117d6d90e Signed-off-by: Gregory Bean <gbean@codeaurora.org> (cherry picked from commit 9c0619be7b93ad114d6f33a749d905ddff93df7d)
* checkpatch: close filp_open loophole.Gregory Bean2013-02-201-0/+6
| | | | | | | | | filp_open allows people to get around the ban on sys_open. Close the loophole. Change-Id: I6e2be62e848cbc064e07008d0886c0d003c8be4b Signed-off-by: Gregory Bean <gbean@codeaurora.org> (cherry picked from commit bb181a18a813a70176f71a0c64aa572fcfbef0f0)
* checkpatch: Handle long multi-line macros better.Gregory Bean2013-02-201-1/+7
| | | | | | | | | | | | | | | Improve parsing of multiline macros which run beyond the available diff context. These beyond-the-horizon macros previously caused two distinct naughty behaviors: - The scanner, confused by the trailing backslash, would grab the header of the next context hunk and treat it as the last line of the preceding macro. - The analyzer, unable to fully reduce the macro, would blame the patch for submitting an unbalanced or unprotected macro. Change-Id: I6b7dd3d577c524d30b59dff7b20393bb5135f16d Signed-off-by: Gregory Bean <gbean@codeaurora.org> (cherry picked from commit ddd028c47b4d91aa9c0e97445eb584b2de367769)
* checkpatch: deprecate unbounded string functions.Gregory Bean2013-02-201-0/+19
| | | | | | | | | Unbounded string functions are overflow risks. The 'n' versions of those functions should be used instead. Change-Id: Ice0fb3ebdae9aa88cc7e764ffdf68cbed857febf Signed-off-by: Gregory Bean <gbean@codeaurora.org> (cherry picked from commit 15e1e97d66dd6a6039c1ec2bd549a632fe361128)
* checkpatch: forbid implied-barrier I/O functions.Gregory Bean2013-02-201-0/+18
| | | | | | | | | | | Forbid read[bwl], write[bwl], in[bwl], and out[bwl], as they contain a 'stealth barrier' which can harm performance. Developers are expected to call appropriate __raw_* or *_relaxed APIs and manage barriers explicitly. Change-Id: Ie4da221c91a0505917199db9e2fdb704c3e47d44 Signed-off-by: Gregory Bean <gbean@codeaurora.org> (cherry picked from commit 032fd4ba09e195d9913c08f460130da9905936ef)
* checkpatch: Merge continuation-header handling from .38.Gregory Bean2013-02-201-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is a cherry pick and squash of commits: 85c2ee62d37c19456c6dc83db262123956f010ac 4bc7c6001daba7d4037f54f67bae7fa90f759402 checkpatch: Handle continuation headers. Continuation headers baffle checkpatch, as it can only operate on one line of context at a time. When continuation headers are found, put them up with the header they're continuing so the whole thing can be parsed in a single line of context. checkpatch: Don't treat diffs as patches. The patch-header cleanup code assumed that it would only ever see patches, which was of course hogwash. This lead to crazy results as it tried to wrap what it thought were continuation lines at the beginnings of raw diffs. Signed-off-by: Gregory Bean <gbean@codeaurora.org> (cherry picked from commit 57d50ae730a057ee1099a94a397475bfd147d97b) Conflicts: scripts/checkpatch.pl Change-Id: I60b2d914ada9a8690b89ffb8c1e32a8b81a5e715
* checkpatch: forbid filesystem accesses from within the kernel.Gregory Bean2013-02-201-0/+6
| | | | | | | | | Use of the sys_open/close/read/write system calls from within kernel code is inappropriate, and now triggers errors. Change-Id: I98e20513c257d0664684b7144585853f617d771a Signed-off-by: Gregory Bean <gbean@codeaurora.org> (cherry picked from commit ee62f2afcac1bcb180b2f0dddf2c8f5cda54bc5b)
* Revert "checkpatch: reject unrelaxed readl/writel."David Brown2013-02-201-7/+0
| | | | | | | | | | This reverts commit 66b2a3733e7219e5291c633eb5778bec6500b74d. Possibly can happen after necessary code changes are in place. Change-Id: I04e092158dda2b5f5ca029378d1e7dc863de6001 Signed-off-by: David Brown <davidb@codeaurora.org> (cherry picked from commit 4235f0aeb789321b36eb01f29ffb329fc9d2169c)
* checkpatch: reject unrelaxed readl/writel.Gregory Bean2013-02-201-0/+7
| | | | | | Change-Id: I9490245ba24df51f1b4a69e2bb46b27da13a333a Signed-off-by: Gregory Bean <gbean@codeaurora.org> (cherry picked from commit 66b2a3733e7219e5291c633eb5778bec6500b74d)
* Don't complain about MIME headers.Gregory Bean2013-02-201-6/+13
| | | | | | | | | | When patches contain extended character sets, patches will contain MIME headers after the subject line, which should not be confused for a too-long summary line. Signed-off-by: Gregory Bean <gbean@codeaurora.org> Change-Id: If17d17cc7513eb644d75f486b9cdea3a09ba0dbe (cherry picked from commit 8e6b9d3790595198a34320f1c3f4504cd258fed1)
* Revert "checkpatch: add check for too short Kconfig descriptions"Bryan Huntsman2013-02-201-15/+0
| | | | | | | This reverts commit 3354957a4f8b9bb4b43625232acdf0626851c82f. Signed-off-by: Bryan Huntsman <bryanh@codeaurora.org> (cherry picked from commit 6839bfe7291e24589884af37de8622ff2bea31e6)
* checkpatch: Import additional rules from android-msm-2.6.32 to msm-2.6.35Matt Wagantall2013-02-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several checkpatch enhancements are imported from android-msm-2.6.32. These include: commit 83ec26e869ac7e967fd5382f9e1979536897d42a Author: Matt Wagantall <mattw@codeaurora.org> Date: Thu Jun 3 12:28:18 2010 -0700 checkpatch: Exceptions for CLK_* macros and some spaces in macros Add CLK_* macros used in MSM clock drivers to the list of exceptions for the "Macros with complex values should be enclosed in parenthesis" test. Also, allow spaces following open branckets for macros where the macro is the first token on the line, the space preceds a decimal number, and the line ends with ")," or ")". Such arrangements can be useful for aligning numerical columns of tables when the rows are described by macros. Change-Id: I7701119ada2ea8fd646e5448eae51786bbf1e8fa Signed-off-by: Matt Wagantall <mattw@codeaurora.org> commit d3ccf20187826d2cfbf41eda3f9e1a38e35b79bf Author: Rick Adams <rgadams@codeaurora.org> Date: Mon Jan 4 13:06:09 2010 -0800 checkpatch: warn on subject line not followed by blank line Fixed case when no warning generated for long subject line that is wrapped to more than one line, and all lines are less than line limit. New warning message added: "non-blank line after summary line" Now there are two warnings possible for the subject line, the original line over limit and the new one. Depending on the error(s) any combination of the two warnings are possible. Commit text requirements now: 1) Must be less than 75 characters 2) Must be followed by blank line. Change-Id: If7ee833339c5be947bb1dd2a52d5d1d9ddfe5de6 Signed-off-by: Rick Adams <rgadams@codeaurora.org> commit ae617dec94111b127c33ae9c979e51b5bd8b5292 Author: Abhijeet Dharmapurikar <adharmap@codeaurora.org> Date: Thu Oct 1 12:01:44 2009 -0700 checkpatch: check for #if 0/#if 1 Warn if #if 1 or #if 0 is present. Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org> commit 168e8da627f99e421be9375ed572df6b1039854f Author: Abhijeet Dharmapurikar <adharmap@codeaurora.org> Date: Thu Oct 1 12:01:44 2009 -0700 checkpatch: check for execute permissions on non code files Make checkpatch.pl check execute permissions on non code files Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org> commit be24800e1cdd44d8b0e00f212c022f34e1402eb4 Author: Steve Muckle <smuckle@codeaurora.org> Date: Fri Apr 3 16:19:20 2009 -0700 checkpatch: check new files for executable permissions Look for executable permissions on new files as well as in mode changes on existing files. Signed-off-by: Steve Muckle <smuckle@codeaurora.org> commit b45a236b62928e0b11fbeff1471d9b1efc508884 Author: Steve Muckle <smuckle@codeaurora.org> Date: Fri Mar 13 15:46:36 2009 -0700 checkpatch: warn on long summary, commit text lines Warn on summary or commit text lines greater than 75 characters. The summary and commit text are indented and may wrap on a terminal if they are longer than 75 characters. Signed-off-by: Steve Muckle <smuckle@codeaurora.org> Change-Id: Iae92cdc8ffecc5315761bc91e883d8ea2f4877cc Signed-off-by: Matt Wagantall <mattw@codeaurora.org> (cherry picked from commit d17f580ee07441770498b54159e3322f8186fc3e) Conflicts: scripts/checkpatch.pl
* Checkpatch: Backport changes from 2.6.35Patrick Pannuto2013-02-201-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport a series of checkpatch changes from 2.6.35; having these checks in our tree now will help with upstreaming efforts. A summary of the changes: (trivial) remove Dave Jones' email Add initconst attribute Switch printk exception to logFunctions check for spaces before a quoted newline check for space before tabs improved check spacing on parentheses improved conditional checking add some exceptions to multi-statement macro exceptions Check that the storage class is at the beginning of a declaration check for sizeof(&) check for various ops structs, ensure they are const. check for lockdep_set_novalidate_class The following commits are included: commit dbf004d7883b3adb058c0c1a5635bc4ec27651c0 Author: Dave Jones <davej@redhat.com> Date: Tue Jan 12 16:59:52 2010 -0500 remove my email address from checkpatch. Maybe this will stop people emailing me about it. Signed-off-by: Dave Jones <davej@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> commit 52131292c069b74f4b5f3c786ff66ff6e82b0e69 Author: Wolfram Sang <w.sang@pengutronix.de> Date: Fri Mar 5 13:43:51 2010 -0800 checkpatch: fix false positive on __initconst checkpatch falsely complained about '__initconst' because it thought the 'const' needed a space before. Fix this by changing the list of attributes: - add '__initconst' - force plain 'init' to contain a word-boundary at the end Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Cc: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> commit 691e669ba8c64d31ac08d87b1751e6acfa3ff65e Author: Joe Perches <joe@perches.com> Date: Fri Mar 5 13:43:51 2010 -0800 checkpatch.pl: allow > 80 char lines for logging functions not just printk Signed-off-by: Joe Perches <joe@perches.com> Cc: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> commit 3354957a4f8b9bb4b43625232acdf0626851c82f Author: Andi Kleen <ak@linux.intel.com> Date: Mon May 24 14:33:29 2010 -0700 checkpatch: add check for too short Kconfig descriptions I've seen various new Kconfigs with rather unhelpful one liner descriptions. Add a Kconfig warning for a minimum length of the Kconfig help section. Right now I arbitarily chose 4. The exact value can be debated. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Andi Kleen <ak@linux.intel.com> Cc: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> commit 5e79d96eed306a8b4af67b3f35f6867edfabeebc Author: Joe Perches <joe@perches.com> Date: Fri Mar 5 13:43:55 2010 -0800 checkpatch: warn on unnecessary spaces before quoted newlines Signed-off-by: Joe Perches <joe@perches.com> Cc: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> commit 08e4436566250cb98b3f3ac37643b1cf09481256 Author: Alberto Panizzo <maramaopercheseimorto@gmail.com> Date: Fri Mar 5 13:43:54 2010 -0800 checkpatch.pl: warn if an adding line introduce spaces before tabs. Signed-off-by: Alberto Panizzo <maramaopercheseimorto@gmail.com> Cc: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> commit 42bdf74c95b6935f3c09a09ba4bead6cad11b540 Author: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Date: Fri Mar 5 13:43:50 2010 -0800 checkpatch: trivial fix for trailing statements check In case if the statement and the conditional are in one line, the line appears in the report doubly. And items of this check have no blank line before the next item. This patch fixes these trivial problems, to improve readability of the report. [sample.c] > if (cond1 > && cond2 > && cond3) func_foo(); > > if (cond4) func_bar(); Before: > ERROR: trailing statements should be on next line > #1: FILE: sample.c:1: > +if (cond1 > [...] > + && cond3) func_foo(); > ERROR: trailing statements should be on next line > #5: FILE: sample.c:5: > +if (cond4) func_bar(); > +if (cond4) func_bar(); > total: 2 errors, 0 warnings, 5 lines checked After: > ERROR: trailing statements should be on next line > #1: FILE: sample.c:1: > +if (cond1 > [...] > + && cond3) func_foo(); > > ERROR: trailing statements should be on next line > #5: FILE: sample.c:5: > +if (cond4) func_bar(); > > total: 2 errors, 0 warnings, 5 lines checked Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Cc: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> commit 22fd2d3e4f75a2596ccdfdcbdfd505c9c60bf346 Author: Stefani Seibold <stefani@seibold.net> Date: Fri Mar 5 13:43:52 2010 -0800 checkpatch.pl: add union and struct to the exceptions list Here is a small code snippet, which will be complained about by checkpatch.pl: #define __STRUCT_KFIFO_COMMON(recsize, ptrtype) \ union { \ struct { \ unsigned int in; \ unsigned int out; \ }; \ char rectype[recsize]; \ ptrtype *ptr; \ const ptrtype *ptr_const; \ }; This construct is legal and safe, so checkpatch.pl should accept this. It should be also true for struct defined in a macro. Add the `struct' and `union' keywords to the exceptions list of the checkpatch.pl script, to prevent error message "Macros with multiple statements should be enclosed in a do - while loop". Otherwise it is not possible to build a struct or union with a macro. Signed-off-by: Stefani Seibold <stefani@seibold.net> Cc: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> commit d4977c78e9c7dd042f96f4a21d957bc25a561333 Author: Tobias Klauser <tklauser@distanz.ch> Date: Mon May 24 14:33:30 2010 -0700 checkpatch: warn on declaration with storage class not at the beginning The C99 specification states in section 6.11.5: The placement of a storage-class specifier other than at the beginning of the declaration specifiers in a declaration is an obsolescent feature. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Acked-by: Jean Delvare <khali@linux-fr.org> Cc: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> commit 8f53a9b80f011080555c498d2ca2dc6b1a77c42c Author: Joe Perches <joe@perches.com> Date: Fri Mar 5 13:43:48 2010 -0800 scripts/checkpatch.pl: add WARN on sizeof(&foo) sizeof(&foo) is frequently an error. Warn on its use. Signed-off-by: Joe Perches <joe@perches.com> Cc: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> commit 79404849e90a41ea2109bd0e2f7c7164b0c4ce73 Author: Emese Revfy <re.emese@gmail.com> Date: Fri Mar 5 13:43:53 2010 -0800 checkpatch.pl: extend list of expected-to-be-const structures Based on Arjan's suggestion, extend the list of ops structures that should be const. Signed-off-by: Emese Revfy <re.emese@gmail.com> Cc: Andy Whitcroft <apw@shadowen.org> Cc: Arjan van de Ven <arjan@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> commit 1704f47b50b5d9e1b825e43e1baaf2c5897baf03 Author: Peter Zijlstra <peterz@infradead.org> Date: Fri Mar 19 01:37:42 2010 +0100 lockdep: Add novalidate class for dev->mutex conversion The conversion of device->sem to device->mutex resulted in lockdep warnings. Create a novalidate class for now until the driver folks come up with separate classes. That way we have at least the basic mutex debugging coverage. Add a checkpatch error so the usage is reserved for device->mutex. [ tglx: checkpatch and compile fix for LOCKDEP=n ] Signed-off-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Change-Id: I11495554d7d393659e5e0d7188cdc1744e25b6ba Signed-off-by: Patrick Pannuto <ppannuto@codeaurora.org> (cherry picked from commit 4657bf482381583b08b34ed5ea6f7d3ad162807c) Conflicts: scripts/checkpatch.pl
* Checkpatch: Print location when catching return code errorPatrick Pannuto2013-02-201-1/+1
| | | | | | | | | | | | | | | | Display context so users can see where there error was OLD: ERROR: illegal return value, please use an error code NEW: ERROR: illegal return value, please use an error code #152: test.c:5: + return -1; Change-Id: I098004d9a5dbeb6c39b35b84ac94fd7a861849d7 Signed-off-by: Patrick Pannuto <ppannuto@codeaurora.org> (cherry picked from commit 8d09803de5d629f3ebc9cb357a40b5937a5d171e)
* Revert "checkpatch: Add warning for blank lines in header"Gregory Bean2013-02-201-9/+0
| | | | | | | | | | | | | This reverts commit 8212698c653945d0fd0783829822917bf13a5aab. The original commit incorrectly prevents the following: - Commit messages which cite other commit messages, which are commonly used for attribution; - Any use of checkpatch which doesn't contain a full mail header, such as 'show <ref> | checkpatch.pl -' Change-Id: I681a97913432d05bf66290cf74972aaa4e03fe5d Signed-off-by: Gregory Bean <gbean@codeaurora.org> (cherry picked from commit c73e32b4a1a59e3a33e9c8975ab08b5475d30f3e)
* checkpatch: Check for illegal return codesPatrick Pannuto2013-02-201-0/+5
| | | | | | | | | | | | | | | | | | The only legal integer return is 0, anything else following "return" should be -ERRCODE or a function. http://lkml.org/lkml/2010/7/23/318 There's lots of "return -1;" statements in this patch - it's obscene that this is used to indicate "some error occurred" in kernel space rather than a real errno value - even when an existing function (eg, request_irq) gave you an error code already. Please note this for the future - and please review patches on this point internally first. Change-Id: I16268b2ee034f0b3b899115e45c28acfa734ddec Signed-off-by: Patrick Pannuto <ppannuto@codeaurora.org> (cherry picked from commit 39531a47164294315b5a7256b520fe22d6e87013)
* checkpatch: remove column limit for checkpatch patchesIsrael Schlesinger2013-02-201-0/+1
| | | | | | | | | | | | | | Currently checkpatch is enforcing an 80 character column limit. This should not be applied for patches modifying checkpatch. Change-Id: I8e8935e633d79a7ee535ce6a90e54447a22d9a91 Signed-off-by: Israel Schlesinger <israels@codeaurora.org> (cherry picked from commit 4aa1b864119e2d0e49efefcd6dba7349f13c3939) Conflicts: scripts/checkpatch.pl
* checkpatch: fix regex for catching mdelay()Israel Schlesinger2013-02-201-1/+1
| | | | | | | | | upstream prefers this change for checkpatch: http://lkml.org/lkml/2010/7/27/254 Signed-off-by: Israel Schlesinger <israels@codeaurora.org> Change-Id: I61f8c1ff622994b37a79fed4b811115da2c108ad (cherry picked from commit 76cc4ad08fe1d8912ce44ee2cc1f10373c2974d3)
* checkpatch: Add warning for blank lines in headerIsrael Schlesinger2013-02-201-0/+9
| | | | | | Signed-off-by: Israel Schlesinger <israels@codeaurora.org> Change-Id: Ie0da3c2842b3d1f194f60c277ae9961dcb82cd59 (cherry picked from commit 8212698c653945d0fd0783829822917bf13a5aab)
* checkpatch: Add warnings for use of mdelay()Israel Schlesinger2013-02-201-0/+5
| | | | | | Signed-off-by: Israel Schlesinger <israels@codeaurora.org> Change-Id: I9e5510a79d51b8f03e03ad8466246f93bf2c623a (cherry picked from commit 084af58596758be6e51ef060aefa2cd622dc9205)
* checkpatch: Add warning for qualcomm emailIsrael Schlesinger2013-02-201-2/+2
| | | | | | | | | People should not be using their qualcomm email when signing off patches or authoring them. Signed-off-by: Israel Schlesinger <israels@codeaurora.org> Change-Id: Ic09516564a6b60576d6fac95e3ce4ccc8c706b0d (cherry picked from commit bde480639313a5de6c2019a93d96767fecceaa78)
* checkpatch: Exceptions for CLK_* macros and some spaces in macrosMatt Wagantall2013-02-201-1/+2
| | | | | | | | | | | | | | | | | | | | Add CLK_* macros used in MSM clock drivers to the list of exceptions for the "Macros with complex values should be enclosed in parenthesis" test. Also, allow spaces following open branckets for macros where the macro is the first token on the line, the space preceds a decimal number, and the line ends with ")," or ")". Such arrangements can be useful for aligning numerical columns of tables when the rows are described by macros. Change-Id: I7701119ada2ea8fd646e5448eae51786bbf1e8fa Signed-off-by: Matt Wagantall <mattw@codeaurora.org> (cherry picked from commit ed6d6ed1c6b8f6016ea5676d075331e31b7ac1f8) Conflicts: scripts/checkpatch.pl
* scripts/checkpatch.pl: warn on invalid credentialsBryan Huntsman2013-02-201-0/+8
| | | | | | | | | @quicinc.com identities are not allowed. Check the "From:" field in the patch, equivalent to the author in the git commit, and the Signed-off-by field. Signed-off-by: Bryan Huntsman <bryanh@codeaurora.org> (cherry picked from commit 374146d3656f815f45145861396df4ee35f60cec)
* checkpatch: warn on subject line not followed by blank lineRichard Adams2013-02-201-1/+16
| | | | | | | | | | | | | | | | | | | | | | | Fixed case when no warning generated for long subject line that is wrapped to more than one line, and all lines are less than line limit. New warning message added: "non-blank line after summary line" Now there are two warnings possible for the subject line, the original line over limit and the new one. Depending on the error(s) any combination of the two warnings are possible. Commit text requirements now: 1) Must be less than 75 characters 2) Must be followed by blank line. Change-Id: If7ee833339c5be947bb1dd2a52d5d1d9ddfe5de6 Signed-off-by: Richard Adams <c_adams@quicinc.com> (cherry picked from commit 78d0db4aa1212e00696e25b7daa9fc4ecd86f954) Conflicts: scripts/checkpatch.pl
* checkpatch: check for #if 0/#if 1Abhijeet Dharmapurikar2013-02-201-3/+8
| | | | | | | | | | | | | Warn if #if 1 or #if 0 is present. Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org> (cherry picked from commit a81f92c9abe442ad5b00e8df31172f145a14af3f) Conflicts: scripts/checkpatch.pl Change-Id: Id28c07eaa907351933e0450751b05e2f749d23d0
* checkpatch: check for execute permissions on non code filesAbhijeet Dharmapurikar2013-02-201-1/+8
| | | | | | | Make checkpatch.pl check execute permissions on non code files Signed-off-by: Abhijeet Dharmapurikar <adharmap@quicinc.com> (cherry picked from commit 315e124e887131124d184f1bf0778ebbb80282fb)
* checkpatch: check new files for executable permissionsSteve Muckle2013-02-201-2/+2
| | | | | | | | Look for executable permissions on new files as well as in mode changes on existing files. Signed-off-by: Steve Muckle <smuckle@quicinc.com> (cherry picked from commit 1ec31f0a5471d173b4d2eecb29f3526d77e7cc60)
* checkpatch: warn on long summary, commit text linesSteve Muckle2013-02-201-1/+55
| | | | | | | | | | | | | | | Warn on summary or commit text lines greater than 75 characters. The summary and commit text are indented and may wrap on a terminal if they are longer than 75 characters. Signed-off-by: Steve Muckle <smuckle@quicinc.com> (cherry picked from commit e2638df6005402597085a58e01b6dd1cf2bdb8a4) Conflicts: scripts/checkpatch.pl Change-Id: I1546ba3b81031051fdbe6319842d6e2d96931416
* scripts: Include copper pattern in build targetsDavid Brown2013-02-201-1/+1
| | | | | | Change-Id: I68e94f8c000df7cc0a481f49df267258aef952da Signed-off-by: David Brown <davidb@codeaurora.org> (cherry picked from commit 2ab0a60d3023a08da712dee9cc5592a216b30ad4)
* build-all.py: Add support for apq defconfigsStephen Boyd2013-02-201-0/+2
| | | | | | | | There is an apq8064_defconfig. Compile it too. Change-Id: I9ca96ab56640c8f3726d052ad43d1624a4ece0a5 Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> (cherry picked from commit d14a37b998dcabb5783f69cc77c66722afdc7567)
* scripts: Add fsm targets to build-all.pyRohit Vaswani2013-02-201-1/+1
| | | | | | Acked-by: Kaushik Sikdar <ksikdar@qualcomm.com> Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org> (cherry picked from commit d5b438ad986952a7b4596a9794724da83582eff8)
* build-all.py: Update defconfigs with savedefconfigStephen Boyd2013-02-201-2/+7
| | | | | | | | | Copy the savedefconfig (or minimal defconfig) instead of the .config when updating defconfigs. Change-Id: I0ba0b7a774dd3de0dc090420bd5c118eb6199eb6 Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> (cherry picked from commit 6575c0b29f060a5ebdeec0ff9bcfe0f1af9f0bc8)
* LOCAL: build_all.py: allow alternate build targets.Gregory Bean2013-02-201-1/+7
| | | | | | | | | | | | Allow make targets to be given to build-all.py, which in turn allows the build-all preverification step to be used to generate all kernel artifacts for later preverification steps. This moves us closer to eliminating the need to build the kernel twice for each commit to be tested by the PV framework. Change-Id: Ifacdbb161604f06f85f4248f21998dda282e6fd0 Signed-off-by: Gregory Bean <gbean@codeaurora.org> (cherry picked from commit 81a73760834ee3c0b3b1ab3010fd6530d5b82313)
* build-all: some convenience fixesPatrick Pannuto2013-02-201-3/+24
| | | | | | | | | * mkdir -p build_dir instead of just failing * Add perf / noperf targets since building "all" is often unnecessary Change-Id: I3216f59338ca37e87b464cccbb9c1cc766356a6c Signed-off-by: Patrick Pannuto <ppannuto@codeaurora.org> (cherry picked from commit b4f13cfa5a53633c0246b2136decc5d210cfcd70)
* build-all: Don't mix tabs / spacesPatrick Pannuto2013-02-201-77/+76
| | | | | | | | | | | | Guido says no to tabs in python (however much I may disagree with him). Regardless of tabs or spaces, you definitely cannot mix them; future versions of the python interpereter plan to simply reject files that mix them outright, so we should follow good style guidelines Change-Id: I32a30ac3ef430916c534738a7349482d3f151fd5 Signed-off-by: Patrick Pannuto <ppannuto@codeaurora.org> (cherry picked from commit cbebac12150f62ec6f9810f09366d5cf66d60875)
* scripts: build-all: Add a keep-going optionStephen Boyd2013-02-201-7/+24
| | | | | | | | | | | | | | | | | | | | | Sometimes I want to build all the targets and see what errors come out while I'm out at lunch. Currently I can't do that so introduce a new option -k/--keep-going in the spirit of make's keep going option to build the rest of the targets even if another target fails. This way after I eat lunch I can go through the logs and see what files are failing. It was suggested that the failing targets could be summarized at the end of the build run. So when we're building many targets keep a list of failing targets to output at the end of the run. This way it's easy to determine which targets need fixing without scouring the logs or the screen buffer. While we're here fixup the above usage message. Change-Id: Ief30ac65eb946e055051bdfdd7ba5788e5a8e426 Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> (cherry picked from commit 3fb23529a8c959042d3efb68888bc18d8fbce0ce)