Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp1734194pxy; Thu, 6 May 2021 14:43:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyontJc7uy7q1FOo3vfgRk17rLmKKMwLA6ExQiS9Nm/G/eCcs8Tf66GdV+1iKxyTp3Fq7fF X-Received: by 2002:a17:906:170a:: with SMTP id c10mr6497253eje.493.1620337419851; Thu, 06 May 2021 14:43:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620337419; cv=none; d=google.com; s=arc-20160816; b=DWf+zpih+N/vw+4/0t03M3EawwAiveeNTfCZ5+GBLtxDyC0XnsEHZV4t6Imrvq1eRN xZyDAHZUHPzacPkzGHJrZenJ9Qnn5xLkAB1AscoTPfoFDozxC3p8eHmr4ijULAtwKjUI GiGykKNd7ER7qlk/b2yIfZjRXEkiFMTUpJHzaGi0rfGq7NtT/+1tSIPAPU581TlhMftX yr7JAl4oTd1scRTUU8ZGhfqWV0REkoD2GpCpOeb2eP39rLKI8tQQrG4KJqMmdeR/EOMM rYi7woVCzo8hrtGRrH7jlMW2JcAOeeaojKnkAJ4efkW0/IR0QplkxIX2C1orSPuV57rz ZU8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=n7PRamjQw6t95QbZFsRzduwpxZ9s8QPHcFiyg9KdZQo=; b=UPJbJSwEeMqJDYXZ4iYLYSWvBbN9WpHTtGtiOvIacUQzyh9K3jmkIYcAV96ZRq2TS0 5o/cLKxWzvaezQCRUOHM9LnbFlqmnNKl82uDQ2MMwYtQKV//jN7MDCcCofbLHJwpM8i/ QpYnTZoYfa7kTWcFWMjB/lqDNEJqAuMMhqr0Z76W/kpqFA1twkdx5uciXwTo0mXYObao xAGgK7QkpoKK02u6bdEd2NAOaBdPTvjATltUkX75Dn/5E7FJFmJeCcscYQhDemlfPt89 gsZDoOQwsL066p6eOS+vZYd8a2D9Uu5d77CWDKwxH+3J1OYXOROzhbr8z4rgwTXbIKlR gTGg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o18si3246240edc.137.2021.05.06.14.43.15; Thu, 06 May 2021 14:43:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230422AbhEFVmh (ORCPT + 99 others); Thu, 6 May 2021 17:42:37 -0400 Received: from smtprelay0085.hostedemail.com ([216.40.44.85]:60806 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229572AbhEFVmd (ORCPT ); Thu, 6 May 2021 17:42:33 -0400 Received: from omf20.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay07.hostedemail.com (Postfix) with ESMTP id C845F181D337B; Thu, 6 May 2021 21:41:33 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf20.hostedemail.com (Postfix) with ESMTPA id B57B718A5F1; Thu, 6 May 2021 21:41:32 +0000 (UTC) Message-ID: <2bea96ba2525c31b18185f51fffea2d2052aa8a0.camel@perches.com> Subject: Re: [PATCH v2] checkpatch: warn about direct use of send_sig_info and force_sig_info From: Joe Perches To: Marco Elver , "Eric W . Biederman" , Dwaipayan Ray Cc: linux-kernel , Andy Whitcroft , Lukas Bulwahn Date: Thu, 06 May 2021 14:41:31 -0700 In-Reply-To: References: <20210506132827.3198497-1-elver@google.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B57B718A5F1 X-Spam-Status: No, score=-1.40 X-Stat-Signature: rmbqdd1f7zd69wjedhqbpyjjxip6gg5g X-Rspamd-Server: rspamout02 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+hBJaFq2jPLbIgp2RNQYdgnMu9j9P57as= X-HE-Tag: 1620337292-37696 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2021-05-06 at 17:22 +0200, Marco Elver wrote: > Setting up siginfo and using send_sig_info() or force_sig_info() > directly is discouraged. Instead, new code wanting to generate signals > should use the appropriate helper specific to the signal. > > Eric mentioned that he'd like to make these static at some point, but > until that can happen, let's try to avoid introducing new users of them. [] > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > @@ -7153,6 +7153,12 @@ sub process { > ? "Where possible, use lockdep_assert_held instead of assertions based on spin_is_locked\n" . $herecurr); > ? } > ? > > +# check for direct use of send_sig_info(), force_sig_info() > + if ($line =~ /\b((?:force|send)_sig_info)\(/) { You want to be able to find uses like 'force_sig_info (...' so you should add a \s* after the capture group. And it's probably simpler and more readable to use if ($sline =~ /\b(force_sig_info|send_sig_info)\s*\(/) { instead of the more complex regex (sline is stripped of comments, $line is not) > + WARN("USE_SIGINFO_HELPER", > + "Where possible, avoid using '$1' directly and use a signal-specific helper setting required siginfo fields (see include/linux/sched/signal.h).\n" . $herecurr); A rather long and complex sentence. How about "Prefer signal-specific helpers over use of '$1' (see: include/linux/sched/signal.h)\n" And in that signal.h file, there's no obvious reference to these signal-specific helpers. Is there a better reference in the Documentation/ tree?