diff options
| author | Bjorn Andersson <bjorn.andersson@sonymobile.com> | 2015-06-25 18:03:24 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-06-25 20:00:42 -0400 |
| commit | 5a6d20ce19b770c9946281783614294b3f570ab8 (patch) | |
| tree | 5ccc301d22f41d8567e34a239f48c24955a2887d /scripts | |
| parent | 10895d2c82cce9650f7d34c81c1bd29958e15293 (diff) | |
checkpatch: validate MODULE_LICENSE content
There is a well defined list of expected values for MODULE_LICENSE so warn
the user upon usage of unknown values.
Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/checkpatch.pl | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index dfeb553de798..4cf4473ebf17 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
| @@ -5626,6 +5626,24 @@ sub process { | |||
| 5626 | } | 5626 | } |
| 5627 | } | 5627 | } |
| 5628 | } | 5628 | } |
| 5629 | |||
| 5630 | # validate content of MODULE_LICENSE against list from include/linux/module.h | ||
| 5631 | if ($line =~ /\bMODULE_LICENSE\s*\(\s*($String)\s*\)/) { | ||
| 5632 | my $extracted_string = get_quoted_string($line, $rawline); | ||
| 5633 | my $valid_licenses = qr{ | ||
| 5634 | GPL| | ||
| 5635 | GPL\ v2| | ||
| 5636 | GPL\ and\ additional\ rights| | ||
| 5637 | Dual\ BSD/GPL| | ||
| 5638 | Dual\ MIT/GPL| | ||
| 5639 | Dual\ MPL/GPL| | ||
| 5640 | Proprietary | ||
| 5641 | }x; | ||
| 5642 | if ($extracted_string !~ /^"(?:$valid_licenses)"$/x) { | ||
| 5643 | WARN("MODULE_LICENSE", | ||
| 5644 | "unknown module license " . $extracted_string . "\n" . $herecurr); | ||
| 5645 | } | ||
| 5646 | } | ||
| 5629 | } | 5647 | } |
| 5630 | 5648 | ||
| 5631 | # If we have no input at all, then there is nothing to report on | 5649 | # If we have no input at all, then there is nothing to report on |
