Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753781AbbDGTsL (ORCPT ); Tue, 7 Apr 2015 15:48:11 -0400 Received: from smtprelay0204.hostedemail.com ([216.40.44.204]:34798 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753168AbbDGTsI (ORCPT ); Tue, 7 Apr 2015 15:48:08 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 40,2.5,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:355:379:541:599:800:960:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2110:2393:2559:2562:2828:2890:2911:3138:3139:3140:3141:3142:3353:3622:3653:3865:3866:3867:3868:3870:3871:3872:3874:4042:4321:4425:5007:6261:7875:7903:9010:9040:10011:10400:10450:10455:10848:11026:11232:11658:11914:12043:12296:12517:12519:12555:12740:13019:13069:13311:13357:14093:14097:19904:19999:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:1:0 X-HE-Tag: flock33_c8115ebb2147 X-Filterd-Recvd-Size: 2800 Message-ID: <1428436083.8406.28.camel@perches.com> Subject: Re: [PATCH v2] checkpatch: validate MODULE_LICENSE content From: Joe Perches To: Bjorn Andersson , Andrew Morton Cc: Andy Whitcroft , linux-kernel@vger.kernel.org Date: Tue, 07 Apr 2015 12:48:03 -0700 In-Reply-To: <1428435440-17092-1-git-send-email-bjorn.andersson@sonymobile.com> References: <1428435440-17092-1-git-send-email-bjorn.andersson@sonymobile.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2081 Lines: 66 On Tue, 2015-04-07 at 12:37 -0700, Bjorn Andersson wrote: > 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 > --- > > Thanks for the review Joe! No charge. > "Proprietary" is in the list because this is the full list of "valid" values > mentioned in include/linux/module.h. So it's the list of licenses valid for > submission, but rather the list of valid values. So the "Proprietary" entry is only for non kernel-tree uses. I wonder if the kernel checkpatch script should account for that. I've no strong opinion though if Andrew wants to accept this as-is. cheers, Joe > Changes since v1: > - Fixed nits pointed out by Joe > - Added comment to clarify the purpose, as well as origin of the values > > scripts/checkpatch.pl | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index 9a8b2bd..ca10d79 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -5431,6 +5431,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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/