From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 041FE47ACF7 for ; Tue, 18 Aug 2026 16:40:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787071220; cv=none; b=Y0NEv9OuHY+lycTWfwpmjuWJux/UyrgIXNuL3ANQgN2ivshvSTgYdBEM0lGk1O0u2rZ2T+bOCJ6c2uYKlh2S76r14oxRwUFiwGWco2nFTH7798N6H/Z18vvmTF7s5bKyWvlimbVciZcbunk0sNpLr4t3TGSFK1ddCosYZVwsD2w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787071220; c=relaxed/simple; bh=vIvvRrJf1eevljNIZawtoTl2oDRR0drxZ1YQEbzP1TQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=VcXpQjuUzvPNLNc/GeS7RRCUostD5QX2Hi+5JxZXJzKhDYx0zE+RVQDs5FwfUo5fvxDKc5PoTHdCTn7KHeSMNFRbS5+57DvDrKYfg6w+z4ZGmKu1GgZ5CbdZrjgxJjAA8C4IPT+RTcuUL1Qt22QPee3HA6T2AbjIotjv7fMi8x0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=emeoatLb; arc=none smtp.client-ip=209.85.216.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="emeoatLb" Received: by mail-pj1-f45.google.com with SMTP id 98e67ed59e1d1-38a0c7e841fso183853a91.2 for ; Tue, 18 Aug 2026 09:40:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787071218; x=1787676018; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=uU0K1J1qyo2A8yO0UKRh5QJUqP3uS5MmkkLxD0v0m/Y=; b=emeoatLbIS1FRZ1FC9bO0psNYZgRn3YCjegIX3IiSYC57SjZVMoswn9DedwKsriFD7 D9hFljwHh1bM3/ABVD/XGefDmNKFGydTZz0WQhQRVkD5NfpyFoqtKfoVeDU8R8CvNxp9 d5DlljIxLpwAVd8+3bog7gOik7b1TxBT3ZPP/swnwTa5P7QMNA+jEvg3vPZDq4pdemnP TSK06xWcy8JllNbY3lsGUU9A/tWhlA3NEo3VA5bGXowHiz3IMeiti+M9qf8DREFppFh4 uu9xeLqHU6bqYKVDX/fcDc7ngcarvMSvdKYMhi/6tfyDZtwWlCjtih7wUhyuqg8h7ber vSqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787071218; x=1787676018; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=uU0K1J1qyo2A8yO0UKRh5QJUqP3uS5MmkkLxD0v0m/Y=; b=Yx9GfxMQThEsGvJqDJ4OsdCNnD3twFigiaW9iwWOGjDl7qRbWqoqWLNaY5hHb2ETpH l+B+IBMyUBdhGUNAQHq420rqPh1DgzoDddpqL4VS4OAVqKKR510XpAVvXNoTT9c+rKe1 W1yNLUlXxer3weu9nILZ4lnFOEboauu4noajWWJKnqrKLgXR/p/Li+8+rpjR7wGEayfT L8fL7AlDOHtDhoPORNBbijoUxpklJ+2idP0CdOByAC02EIIy2plC8dtgps/lF3gw042O FCxjeZeB5d88fu6U5FSp8qMfNckh1DeAOnn2v3c7saCNRQdEg6rvsDXgqecd+nt2gtWd 8N1A== X-Forwarded-Encrypted: i=1; AHgh+Rov04aC3xIIGXYrpn5N8okDqEulUeRerm/VkC88R6Ayo9zYQYm7zS3shUdVL0L4yN/mQrzaNd0XDvprvr0=@vger.kernel.org X-Gm-Message-State: AOJu0YxJlo9cVERahON3oE7u2K2joNyWskxa8IFzZpVZGxskzmKXq7p1 3r9FbI5+dL01npzAiyilQwUDPrpgOnlTL9cmNt2gmD4lpsghNrQtLMiz X-Gm-Gg: AR+sD10lkDZnpY2jI2L1N9i0XLnU9GwjdBUb3yqNXCYqJA/VqiAgKN/BR5BvoRczCdL WMgB52hiZOtfGB0zQgjmNVWSQj7U1NgP2L3Ee1l5dLVoouV7evlvNjsnY0V5bTc0ezj+74Mr4iv 63qTSbPNB+Wp1bzLfRoZQv188Io41OWvPdw8V+ThRWsyTUZI7E2PljGcr/yX4jOEt+fNTmK+cVK WjWF1Z67c+/fTth/B8gZ85B1QhGPYXAjtlkh+O7IfrrTtWQ54uNfoEQFuHRPDRPmmq6Vsys9nIs GZGnIqxpiUeUgWelHXQ71P7WokzNwF+NRetnjqSkUIq6eHsqP8f5Z0W+Fam5kM7s3/xpR/PL0Le HGFuphnW0uly+9nvXdNQQgAlEe4skl4b1SXIVoBKAqdVMcvVGU/0baNyEnTvs3wRW00xlhDAYUr lNF7TkgDscfMptyY1470XITemZfPmBRZer+SAQXDSRopcRRNwUJPmXW1XLzTnk4w== X-Received: by 2002:a17:90a:ec83:b0:381:e74f:8a6a with SMTP id 98e67ed59e1d1-3933b8c1041mr40112468a91.16.1787071218282; Tue, 18 Aug 2026 09:40:18 -0700 (PDT) Received: from phi.nguyendp ([116.86.160.247]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3267c897e37sm20988356eec.28.2026.08.18.09.40.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Aug 2026 09:40:17 -0700 (PDT) From: Nguyen Dinh Phi To: Andy Whitcroft , Joe Perches Cc: Nguyen Dinh Phi , linux-kernel@vger.kernel.org Subject: [PATCH] checkpatch: check parenthesis alignment against unmodified anchor lines Date: Wed, 19 Aug 2026 00:40:10 +0800 Message-ID: <20260818164011.1313164-1-phind.uet@gmail.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The PARENTHESIS_ALIGNMENT check only compares a continuation line's indentation against the previous line when that previous line was itself added by the patch (prefixed with '+'). If a patch touches only the continuation line of a wrapped condition and leaves the line with the opening parenthesis as unmodified context, the check is silently skipped even though alignment is broken. For example, this hunk drops a stale sk_err check but breaks parenthesis alignment on the remaining continuation line, while the anchor "while (" line stays as context: while ((connected = vsock_dequeue_accept(listener)) == NULL && - listener->sk_err == 0 && timeout != 0) { + timeout != 0) { checkpatch --strict reports "0 checks" for this hunk because the anchor line is unchanged context rather than a '+' line, so the regex matching it never fires. Relax the anchor-line match to also accept unmodified context lines, so alignment is still checked against an anchor line the patch itself didn't touch. Keep the check scoped to lines the patch actually changes by requiring the current line to start with '+', so pairs of untouched context lines are not newly flagged. Signed-off-by: Nguyen Dinh Phi Assisted-by: Claude:claude-sonnet-5 --- scripts/checkpatch.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index f424dafce5bc..589fa6572d95 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -4057,9 +4057,12 @@ sub process { } # check multi-line statement indentation matches previous line +# (the anchor line may be unchanged context when only a continuation +# line of the statement is touched by this patch) if ($perl_version_ok && - $prevline =~ /^\+([ \t]*)((?:$c90_Keywords(?:\s+if)\s*)|(?:$Declare\s*)?(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*|(?:\*\s*)*$Lval\s*=\s*$Ident\s*)\(.*(\&\&|\|\||,)\s*$/) { - $prevline =~ /^\+(\t*)(.*)$/; + $line =~ /^\+/ && + $prevline =~ /^[\+ ]([ \t]*)((?:$c90_Keywords(?:\s+if)\s*)|(?:$Declare\s*)?(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*|(?:\*\s*)*$Lval\s*=\s*$Ident\s*)\(.*(\&\&|\|\||,)\s*$/) { + $prevline =~ /^[\+ ](\t*)(.*)$/; my $oldindent = $1; my $rest = $2; -- 2.53.0