From: Bjorn Andersson Date: Thu, 25 Jun 2015 22:03:24 +0000 (-0700) Subject: checkpatch: validate MODULE_LICENSE content X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5a6d20ce19b770c9946281783614294b3f570ab8;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Cc: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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 { } } } + +# 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