From nobody Sun Sep 14 07:41:41 2025 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 08B90C54E94 for ; Tue, 24 Jan 2023 23:17:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234341AbjAXXRF convert rfc822-to-8bit (ORCPT ); Tue, 24 Jan 2023 18:17:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230221AbjAXXRD (ORCPT ); Tue, 24 Jan 2023 18:17:03 -0500 Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96A694F341 for ; Tue, 24 Jan 2023 15:17:01 -0800 (PST) Received: from omf13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 7C346AB323; Tue, 24 Jan 2023 23:17:00 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf13.hostedemail.com (Postfix) with ESMTPA id 197112000D; Tue, 24 Jan 2023 23:16:56 +0000 (UTC) Message-ID: <36069dac5d07509dab1c7f1238f8cbb08db80ac6.camel@perches.com> Subject: [PATCH] checkpatch: Improve EMBEDDED_FILENAME test From: Joe Perches To: Heinz Mauelshagen , "apw@canonical.com" , Andrew Morton Cc: LKML Date: Tue, 24 Jan 2023 15:16:55 -0800 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 X-Rspamd-Queue-Id: 197112000D X-Stat-Signature: 4i5n3hg93edqeco6xjbitqofqjzdgpmf X-Rspamd-Server: rspamout05 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+ElIneKqzk8BOiFcZlPbCWae08MyF3kNs= X-HE-Tag: 1674602216-665982 X-HE-Meta: U2FsdGVkX1+h9CH2AcKFseB6jVNxUVyOQh/SZL70vg9OIdXIq29f/2LBbTHQRBbO+zLFyAbwXNNyXQgVOkMFuw== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Privately, Heinz Mauelshagen showed that the embedded filename test is not specific enough. > WARNING: It's generally not useful to have the filename in the file > #113: FILE: errors.c:113: > + block < registered_errors.blocks + registered_errors.count; Extend the test to use the appropriate word boundary tests. Reported-by: Heinz Mauelshagen Signed-off-by: Joe Perches --- Heinz, next time please make sure to CC linux-kernel@vger.kernel.org scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index a6d6d7e1d0cf1..40102bc0ce535 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3727,7 +3727,7 @@ sub process { } =20 # check for embedded filenames - if ($rawline =3D~ /^\+.*\Q$realfile\E/) { + if ($rawline =3D~ /^\+.*\b\Q$realfile\E\b/) { WARN("EMBEDDED_FILENAME", "It's generally not useful to have the filename in the file\n" . $= herecurr); }