Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1447859ybi; Thu, 30 May 2019 18:11:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwck0CqDbRUJHQNkg9OtOy/csvy18BujcjuiCbtotJN5/yqocC+oU9f8+PBkKN5ymU4WLNT X-Received: by 2002:a62:1a0f:: with SMTP id a15mr6919457pfa.111.1559265102149; Thu, 30 May 2019 18:11:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559265102; cv=none; d=google.com; s=arc-20160816; b=VUNluMAemxl3sagYCgpZ6/3ZPXaVnWgSrXTnzaH1Ez88H0GWNwK/fTrWRTO6fLQFK0 rFRfqtOPg0715hTZO9en8hqnitUA0Fx6qoMdpwrlIvxKWAYFJghZjf/7cwBjQIOMH2PY 36omitKCk8cR6hi31fjZPe8JpqerqKWB73EoZREoKXNmDALWLi4aD8cnWsKc8YnR8cmk Ax1NIkldo2+G6gUajuspiPQfwk65pOENxLEwmwJnbBUhQLI9R5lnhKQLTRjWJKf15GmJ JfIHYp+CaPivwB+MFV3S5pTLKMTh88kKReUJyzEl/yV9OO/HQrPQQs9S4sLCM/0tSFuz +vXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=22GphBC4iQMWrcK9lLTSPr58LtVk4GbbDGfuWv/oHsQ=; b=xjFahp4HL3T/Z5LPx61IZYQ4z2gMgJ+JjH3hbdmC96MFyzPlBEInzsslsi7wxfs2tK vARREAdeUeAZvKwoN2N3Zl0xlUgC4k7FAzfJeKNkN8u38SI2tY71vG65SAPg65kzDs/N epxWLuSXtU4NQYuRG2hrF5953PPkrgS2r4JbSjv19yerV4EUQ+lSeb2M/6YrbLFLItwA n/X1xv5xgb1t6tnhNC44s/jEYtag1OrkCZfHupvaK2312AZ+asN0UIyeC82OgiTwfqlU +9CwEs3+ritOqS01UFvpvgEQD2r5cwN0Tqf/0hxCuhTg8aVxh7pXynhDuorkJJsR6gRw +Oog== 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 g12si2870458pje.9.2019.05.30.18.10.47; Thu, 30 May 2019 18:11:42 -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 S1726583AbfEaBIx (ORCPT + 99 others); Thu, 30 May 2019 21:08:53 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:46310 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726128AbfEaBIw (ORCPT ); Thu, 30 May 2019 21:08:52 -0400 Received: by mail-lf1-f66.google.com with SMTP id l26so6481673lfh.13 for ; Thu, 30 May 2019 18:08:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=22GphBC4iQMWrcK9lLTSPr58LtVk4GbbDGfuWv/oHsQ=; b=Ce44JVWKG9rNRWgkA2cmi56fCl2QAsWmY08q1qoA/6yFd2MHwPy2tw2A+ndjrCRVKx bsioEin+I9jPF6f9b8pp67a1xhWHBSosH4p/kK+GZBSAdQwo4jz9c1j/PSPESAng+7Ms 9AQZqHcF0F9rb6UjZTYUJ6J4DCoY/5vtheD7jA7In4H+PZ+9qOb2e6S65TxEdGGA+bez 2b+kd8rUXhMhDvs+dJye0bcG7BXy5JdKYcP9gvlLZG2wzNhVtZs+c6TFHe5KpSf9PES7 TM+d7SVLX+F0fTtAf/c3MkajMHEKKzSY1lCMRIOUR8hRShxBMK9uIPL7NNTn7Mo4xJfp QY9w== X-Gm-Message-State: APjAAAWy+INNm7vwyyJd+0pt94lk5z0nw3C+Wlf5vCMVKkv4IbmLtdGU BTRtw7DBvKUcpG9AHjqySz9jLU1Mb+67JI4OS+4cFQ== X-Received: by 2002:a19:ed07:: with SMTP id y7mr4011314lfy.56.1559264930681; Thu, 30 May 2019 18:08:50 -0700 (PDT) MIME-Version: 1.0 References: <20190530235101.3248-1-mcroce@redhat.com> <685e8554eed17eebc731d62336ef30eb44bd14f7.camel@perches.com> In-Reply-To: <685e8554eed17eebc731d62336ef30eb44bd14f7.camel@perches.com> From: Matteo Croce Date: Fri, 31 May 2019 03:08:14 +0200 Message-ID: Subject: Re: [PATCH] checkpatch.pl: Warn on duplicate sysctl local variable To: Joe Perches Cc: LKML , Andy Whitcroft , Kees Cook , Aaron Tomlin , Matthew Wilcox , Andrew Morton Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 31, 2019 at 2:55 AM Joe Perches wrote: > > On Fri, 2019-05-31 at 01:51 +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: > [] > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > [] > > @@ -6639,6 +6639,13 @@ 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/) { > > + my $extracted_string = get_quoted_string($line, $rawline); > > + WARN("DUPLICATED_SYSCTL_CONST", > > + "duplicated sysctl range checking value '$1', consider using the shared one in include/linux/sysctl.h" . $extracted_string . "\n" . $herecurr); > > + } > > why is $extracted_string used here? > > Right, it's always empty. I'm sending a v2. Regards, -- Matteo Croce per aspera ad upstream