Commit 5a6d20ce authored by Bjorn Andersson's avatar Bjorn Andersson Committed by Linus Torvalds

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: default avatarBjorn Andersson <bjorn.andersson@sonymobile.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 10895d2c
...@@ -5626,6 +5626,24 @@ sub process { ...@@ -5626,6 +5626,24 @@ sub process {
} }
} }
} }
# validate content of MODULE_LICENSE against list from include/linux/module.h
if ($line =~ /\bMODULE_LICENSE\s*\(\s*($String)\s*\)/) {
my $extracted_string = get_quoted_string($line, $rawline);
my $valid_licenses = qr{
GPL|
GPL\ v2|
GPL\ and\ additional\ rights|
Dual\ BSD/GPL|
Dual\ MIT/GPL|
Dual\ MPL/GPL|
Proprietary
}x;
if ($extracted_string !~ /^"(?:$valid_licenses)"$/x) {
WARN("MODULE_LICENSE",
"unknown module license " . $extracted_string . "\n" . $herecurr);
}
}
} }
# If we have no input at all, then there is nothing to report on # If we have no input at all, then there is nothing to report on
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment