Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp312187ybi; Fri, 31 May 2019 01:46:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwhCJo53gKthvAF3mjJ3wtSxgJ9cnR2YbdFfoWscp+TU6PiL0H22eLU6QEwRfQcgKYjDmH X-Received: by 2002:a17:90a:8d14:: with SMTP id c20mr7911448pjo.134.1559292369591; Fri, 31 May 2019 01:46:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559292369; cv=none; d=google.com; s=arc-20160816; b=M1bHuP+p3V6FAId9LenbIoH77ql5HMTqqRaBDuN4CdzolL78VAiO2AdAfFzXBzYwhz 5f8k5pj+Ac6qymOXtQ2Oap1fchYiZuhH8X9miozdQza7Mid9DdikT5Y7+gHRNJ5Lu0sB rNkdwOIROcdPDByA7Pkt+TjTJonDyoqhBUJF/yz8NuGNMj4p+eoqr4iFw7580yynlS+2 OltyQvTXGrjXImTcoVqZoAgWqnPDMlkBsKxK2CiFVXNY0Tn6PbBNnX6nG8ej53RP+Y/H 08zUuZGRxlh1KS79ipBkKwhZ8uSTg34s3Nh6brcJrguKJ6f1+BcWHwgKnakjSoQIKsGm 4RVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:from:cc:to:subject :content-transfer-encoding:mime-version:references:in-reply-to :user-agent:date; bh=NxX6eHJtGay1RBcKLcoz9L6V+sCQdsIiKYs55x9qpNw=; b=DsBaVhUTe26zoPq60MirW73xBqGL6XijkytF2zEjsxz1SG7+97QNhGawnBAeNDbJdv iVz+pNSiQNTEWTpT2rIJxrAUtxXVCD6FqPG67hvN/SvjtmQSlZzlnqmyZyyHVFZn1weZ 94pdSVfEW53bPJtNBFi601w5xo6RLX3ABiFevB2eHxr5LyiukC4fSCmSjxogPynXcrVn DXwLwqXKbzxGAvEpl/14s+CPR4EoFARyfWn+lqv/8gSJskoP5XNUYfc8KTfrsCR7WsGW rp2DSn60GuZrzSu6tkeDvd7xyB1Qff+Oms12y8alekH9jwcXZFfsDZOwGBkD4JYaMsFH 12xw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c135si6240519pfb.150.2019.05.31.01.45.52; Fri, 31 May 2019 01:46:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726593AbfEaIoo convert rfc822-to-8bit (ORCPT + 99 others); Fri, 31 May 2019 04:44:44 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:36552 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726158AbfEaIoo (ORCPT ); Fri, 31 May 2019 04:44:44 -0400 Received: by mail-wr1-f68.google.com with SMTP id n4so2873745wrs.3 for ; Fri, 31 May 2019 01:44:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:user-agent:in-reply-to:references :mime-version:content-transfer-encoding:subject:to:cc:from :message-id; bh=6M6dXVXKFghnFsr3QMCnxQXaLInVC+XDKbFfMFVfErM=; b=YvoIAImPBz0rQRMAM5LcQdoRFP+1rkFksOvebiH1IMX6SOJARWBT5J5aCVKj/sGqBn o0yViOkmfKa4zJVkXxphAtkycN7wbIodIF1IeDCFd5MX/FzXYirqspc11ZKS0w8JpUSL IB9MHYx6zAdNeTH9ZqHjGTpCCSMjzJgdnarTINGBO79vZbIUYkfyO57BuQPxa/wuoPv4 27FNRQNDCvbxf5Q39wrGmbIVMBckHWt9gSDgYZFUg6t1T01sYQtUcFqTCCUZLxE8jBv+ DVEmqWFkYLvX8JdJrW6ZWfqesFDlPB+arp82garAqAdlEpO2iIc3HMzZXFezD8Ujg8H7 +9Kg== X-Gm-Message-State: APjAAAVRwokME4VLCoavfe97ViPqYNt2Oeue/Zr6xYeknIJynIemtngm aJsTwcm0mKp8ArxJMESvl4Ko4A== X-Received: by 2002:adf:f483:: with SMTP id l3mr159106wro.256.1559292282362; Fri, 31 May 2019 01:44:42 -0700 (PDT) Received: from [10.82.105.87] (mob-5-90-59-71.net.vodafone.it. [5.90.59.71]) by smtp.gmail.com with ESMTPSA id f197sm5459428wme.39.2019.05.31.01.44.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 May 2019 01:44:41 -0700 (PDT) Date: Fri, 31 May 2019 10:44:38 +0200 User-Agent: K-9 Mail for Android In-Reply-To: References: <20190531011227.21181-1-mcroce@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Subject: Re: [PATCH v2] checkpatch.pl: Warn on duplicate sysctl local variable To: Joe Perches , linux-kernel@vger.kernel.org, Andy Whitcroft CC: Kees Cook , Aaron Tomlin , Matthew Wilcox , Andrew Morton From: Matteo Croce Message-ID: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On May 31, 2019 5:06:58 AM GMT+02:00, Joe Perches wrote: > On Fri, 2019-05-31 at 03:12 +0200, Matteo Croce wrote: > > Commit 6a33853c5773 ("proc/sysctl: add shared variables for range > check") > > adds some shared const variables to be used instead of a local copy > in > > each source file. > > Warn when a chunk duplicates one of these values in a ctl_table > struct: > > > > $ scripts/checkpatch.pl 0001-test-commit.patch > > WARNING: duplicated sysctl range checking value 'zero', consider > using the shared one in include/linux/sysctl.h > > #27: FILE: arch/arm/kernel/isa.c:48: > > + .extra1 = &zero, > > > > WARNING: duplicated sysctl range checking value 'int_max', > consider using the shared one in include/linux/sysctl.h > > #28: FILE: arch/arm/kernel/isa.c:49: > > + .extra2 = &int_max, > > > > total: 0 errors, 2 warnings, 14 lines checked > > > > Signed-off-by: Matteo Croce > > --- > > scripts/checkpatch.pl | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > > index 342c7c781ba5..629c31435487 100755 > > --- a/scripts/checkpatch.pl > > +++ b/scripts/checkpatch.pl > > @@ -6639,6 +6639,12 @@ sub process { > > "unknown module license " . $extracted_string . "\n" . > $herecurr); > > } > > } > > + > > +# check for sysctl duplicate constants > > + if ($line =~ /\.extra[12]\s*=\s*&(zero|one|int_max|max_int)\b/) { > > why max_int, there isn't a single use of it in the kernel ? Because you can never know how a local variabile will be called. I wanted to add intmax and maxint too, bit it seemed too much. Bye, -- Matteo Croce per aspera ad upstream