public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkpatch: validate MODULE_LICENSE content
@ 2015-04-06 18:43 Bjorn Andersson
  2015-04-07  0:17 ` Joe Perches
  0 siblings, 1 reply; 8+ messages in thread
From: Bjorn Andersson @ 2015-04-06 18:43 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches; +Cc: linux-kernel

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>
---
 scripts/checkpatch.pl | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d124359..7087b28 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5354,6 +5354,22 @@ sub process {
 				}
 			}
 		}
+
+		if ($line =~ /MODULE_LICENSE\(($String)\)/) {
+			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
-- 
1.8.2.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-06-09 14:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-06 18:43 [PATCH] checkpatch: validate MODULE_LICENSE content Bjorn Andersson
2015-04-07  0:17 ` Joe Perches
2015-04-07 19:37   ` [PATCH v2] " Bjorn Andersson
2015-04-07 19:48     ` Joe Perches
2015-04-07 19:55       ` Bjorn Andersson
2015-04-07 20:16         ` Andrew Morton
2015-06-09 12:11           ` Michal Simek
2015-06-09 14:57             ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox