From nobody Fri Dec 19 16:26:28 2025 Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) (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 C47EF2E9EB5 for ; Fri, 5 Dec 2025 05:35:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764912906; cv=none; b=Euswqb+ntIyEydg/QkKHr75F2a/+3B8LAgP5U1o5Lm5WQolVAWuszhYCn/H+Vmo/AMeioq0Dn11yX+Ulr9lSZsyqi5j12gQudjf30X79q8mGjaGpvQhbEbJAXEyDrE5s4IY9kpSlrcyTaXoDGPyQlBHz8Q8aNMjUaKK+hL5zhSc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764912906; c=relaxed/simple; bh=fTpfMVcHB5u15fI4IzFSiyMYU/urVT15uWM5dAd1Lbc=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=XZqEmZJIhpc7FwJOTV6n5jCchjmJaqvNxfUYHOyiXrw0UzpvJto+vOxTzXg73idigF53nP0Bxq7hvbRVSvv81SUdG7urj0AZ4P0nH0seN8gQlG3qb0DwpkifTtMvfX6n5D7khQbOjLDqytQ6idAh8EKnj6O/mtS4nENwino5gX0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=LNHXbWF8; arc=none smtp.client-ip=209.85.215.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="LNHXbWF8" Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-b471737e673so2129748a12.1 for ; Thu, 04 Dec 2025 21:35:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1764912903; x=1765517703; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=HK7EW7njeUg6DCV4+a4gMaiPRBoOKICA5ibs7PuACdQ=; b=LNHXbWF8+tbN7NnsV0BlIqz0wF8430jOl8WEODkZWJmHVP2Qp7A9yS73ei2YCXNDr0 MsGdr4+XaA4MFdRdJSi2dVHgsh0tRhIO57MVbWwGiNCcUE5ywebhzhFpS4pPDhPSpS3N juuJx+4LEp8GpV32RAyir8pZDnrWkTVJe3kYfcKZ77emtT69DRsRf2VhYJ0Bbs/MP2Kv GK+sECsO54Uk/qdmS+tx+QqWaUKCeBujOK2KTt8wMGOsroMWzld3oflSwrl22psk6xs2 AsuHWO6UBHK/z/OJJx1091zt0zVJoBgbzRmZKt6nrDBokViHKkkOVhYuho7Fi3fPzGH2 +4Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764912903; x=1765517703; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=HK7EW7njeUg6DCV4+a4gMaiPRBoOKICA5ibs7PuACdQ=; b=d+fTSRn+GS/AVAsmUTWsnkA70wZ9YfEXdxaBp54LRUdPeG1g7X4ntevTX7vnnrq/nE 8Egr6mBn3uu8yj9cppFc1dBN9XT61U3WJbk6XDRABR6E7tg1iTbvt9xavVjvYWrQW5nN yd+Yfo9bQnusjIEuVYhnL1Fig+0bmvWSTR6Y+T9Iaqt9AfbLnHvfhEgPQ8Cjc+x30UlA oIQF3niiCYUCnj5bz5Pl9t+7zuxlJ98WYVqzQvo47X0r3dcL04+B6UL7iGYhNgbmhaCQ s9mJo0+Rlp8ZhZMmNma2ZLpdNCZFMufjFCxENTOP/TAK9HJVV0d7zDGdkmK8Us6/PWWZ JrQg== X-Forwarded-Encrypted: i=1; AJvYcCUtbZvz5bMqbZ75fzQUiwTSpIuZfQ7NUwG2uwZtXgVkcJgIPWsbInIm99wvhlwtzLnrXLIPINKoLMzmpeY=@vger.kernel.org X-Gm-Message-State: AOJu0YwvYCFjYmMM9YXcRzJuB8l+34tQ2Oby2e9jQYqWilKOxwRErtqP Mdxp+8t+HGtYxELoG9N9mrgSYAS8/jHHKsz7flpQw8rabBFsZsEzajlHdXIHiJq1PHTJ1dPrEqU a2q/mo+dr2A== X-Google-Smtp-Source: AGHT+IGk+jwLTjNCxAXE+ZqE0WFlk1h8kHLsvFokUufMVmTwcCEs+/SA4+1MUfOE0oa/9uBkq5DUI8OHbqLJ X-Received: from dlbbu27.prod.google.com ([2002:a05:7022:221b:b0:119:49ca:6b9d]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:4191:b0:119:e569:f629 with SMTP id a92af1059eb24-11df0c51441mr7320084c88.34.1764912902571; Thu, 04 Dec 2025 21:35:02 -0800 (PST) Date: Thu, 4 Dec 2025 21:34:57 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.52.0.223.gf5cc29aaa4-goog Message-ID: <20251205053457.8556-1-irogers@google.com> Subject: [PATCH v1] checkpatch: Warn about sign offs if there's an accidental patch separator From: Ian Rogers To: Andy Whitcroft , Joe Perches , Dwaipayan Ray , Lukas Bulwahn , linux-kernel@vger.kernel.org Cc: Namhyung Kim , Stephen Rothwell , Ian Rogers Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The regex ^---$ to detect a patch separator, means a patch is considerd to have been separated only when the line is exactly just "---". git-mailinfo (and thus git am) treats any line starting with "---" as the start of a patch. This can mean a comment causes git-mailinfo to truncate the commit message if the line in the comment starts with "---". checkpatch won't warn about things like missing sign offs after the "---" started comment as it doesn't see the patch as having started yet. The recording of sign offs is made to ignore the case it is in a patch. This issue caused missing tags in commit 6528cdd61590 ("perf tests stat: Add test for error for an offline CPU") as reported by Stephen Rothwell in: https://lore.kernel.org/lkml/20251205092428.3e2b94e3@canb.auug.org.au/ Before: $ ./scripts/checkpatch.pl v2-0006-perf-tests-stat-Add-test-for-error-for-= an-offline.patch total: 0 errors, 0 warnings, 39 lines checked v2-0006-perf-tests-stat-Add-test-for-error-for-an-offline.patch has no ob= vious style problems and is ready for submission. After: $ ./scripts/checkpatch.pl v2-0006-perf-tests-stat-Add-test-for-error-for-= an-offline.patch ERROR: Missing Signed-off-by: line(s) total: 1 errors, 0 warnings, 39 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inpl= ace. v2-0006-perf-tests-stat-Add-test-for-error-for-an-offline.patch has style= problems, please review. NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. Signed-off-by: Ian Rogers Tested-by: Kuan-Wei Chiu --- scripts/checkpatch.pl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 92669904eecc..4fb04162ee56 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2819,6 +2819,11 @@ sub process { $is_patch =3D 1; } =20 +# Once the patch separator is encountered git-mailinfo will treat the rest= as a patch + if ($has_patch_separator) { + $is_patch =3D 1; + } + #extract the line range in the file after the patch is applied if (!$in_commit_log && $line =3D~ /^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@(.*)/) { @@ -2989,7 +2994,7 @@ sub process { } =20 # Check the patch for a signoff: - if ($line =3D~ /^\s*signed-off-by:\s*(.*)/i) { + if (!$is_patch && $line =3D~ /^\s*signed-off-by:\s*(.*)/i) { $signoff++; $in_commit_log =3D 0; if ($author ne '' && $authorsignoff !=3D 1) { @@ -3028,7 +3033,7 @@ sub process { } =20 # Check for patch separator - if ($line =3D~ /^---$/) { + if ($line =3D~ /^---/) { $has_patch_separator =3D 1; $in_commit_log =3D 0; } --=20 2.52.0.223.gf5cc29aaa4-goog