From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4052C7EE24 for ; Tue, 6 Jun 2023 15:11:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237815AbjFFPLP convert rfc822-to-8bit (ORCPT ); Tue, 6 Jun 2023 11:11:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233277AbjFFPLN (ORCPT ); Tue, 6 Jun 2023 11:11:13 -0400 Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A9D91B5 for ; Tue, 6 Jun 2023 08:11:11 -0700 (PDT) Received: from omf19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 6CC35160658; Tue, 6 Jun 2023 15:11:08 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf19.hostedemail.com (Postfix) with ESMTPA id 487DA20029; Tue, 6 Jun 2023 15:11:04 +0000 (UTC) Message-ID: <9717acd3dd00d607da718da251a0bba6b376da96.camel@perches.com> Subject: Re: [PATCH] checkpatch: check for missing Fixes tags From: Joe Perches To: Dan Carpenter , Andy Whitcroft , Dwaipayan Ray , Lukas Bulwahn , linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Arnd Bergmann , Kees Cook , Sasha Levin , Tom Gall Date: Tue, 06 Jun 2023 08:11:03 -0700 In-Reply-To: References: Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.48.2 (3.48.2-1.fc38) MIME-Version: 1.0 X-Stat-Signature: e8yizfse93tg34wrnxuks1axdeyptqji X-Rspamd-Server: rspamout07 X-Rspamd-Queue-Id: 487DA20029 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+javYTQk+znKLFunfTX/GuQNyDwql5ppE= X-HE-Tag: 1686064264-172003 X-HE-Meta: U2FsdGVkX1+eUvA1i0Fj9NdSdrQT4hO2mjQv92PtA4kgpE592e6rAUI3ME5m6kc/aR+LitmPRJmYeBdyse8MSNXulh2JgBTfY3OeW3bBqx5wxzTRqYbJe1QT0sM58LArvNmrF2Vm2++3q9Tw5hhUtlwGAb4Jchkgz/O/FLUmU3KycC7FahjjhIKIr7B+V1HaZok109BExatA9FZr1OdBXhBIr1262F5TXYb8tEcz5M0Tu6y+TP9OZi3sEekDA+5iSXwwZSV32nD49EWBuhPwwRuRTdEOWPDqZzN0GIsvAtFj++Kt1iOcHoFLWrZ3qNLG Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2023-06-06 at 11:30 +0300, Dan Carpenter wrote: > This check looks for common words that probably indicate a patch > is a fix. For now the regex is: > > (BUG: KASAN|Call Trace:|syzkaller|stable\@) Seems sensible. Style notes: > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > @@ -3186,6 +3192,12 @@ sub process { > } > } > > +# These indicate a bug fix > + if (!$in_header_lines && > + $line =~ /(BUG: KASAN|Call Trace:|syzkaller|stable\@)/) { > + $needs_fixes_tag++; Align to open parenthesis please. Maybe add "Closes:" This should not check any actual patch lines. So this should likely use if (!$in_header_lines && !$is_patch && $line =~ /\b(?:BUG: KASAN|Call Trace:|Closes:|syzkaller|stable\@)/) { There's no use of $needs_fixes_tag as something other than a bool, so please just use $needs_fixes_tag = 1; > @@ -3198,6 +3210,7 @@ sub process { > my $id_length = 1; > my $id_case = 1; > my $title_has_quotes = 0; > + $fixes_tag++; $fixes_tag = 1; here too > @@ -7636,6 +7649,12 @@ sub process { > ERROR("NOT_UNIFIED_DIFF", > "Does not appear to be a unified-diff format patch\n"); > } > + if ($is_patch && $has_commit_log && $chk_fixes_tag) { > + if ($needs_fixes_tag && $fixes_tag == 0) { if ($needs_fixes_tag && !$fixes_tag) { > + ERROR("MISSING_FIXES_TAG", > + "This looks like a fix but there is no Fixes: tag\n"); Alignment to open parenthesis and likely WARN not ERROR