Re: [PATCH RESEND] checkpatch: validate upstream commit tags for stable backports

Greg KH
2026-05-05T12:42:07Z

On Tue, May 05, 2026 at 01:23:21PM +0200, Yunseong Kim wrote:
> According to the stable kernel rules (Option 3), backported patches
> should include the upstream commit reference using the SHA1 in one of
> two specific formats:
>
> 1. commit <40 length sha1> upstream.
> 2. [ Upstream commit <40 length sha1> ]
>
> Currently, checkpatch.pl does not validate these stable-specific
> formats, allowing truncated SHA1 characters to pass without notice.
>
> These tags often conflict with the standard GIT_COMMIT_ID rule, which
> expects a "12+ chars of sha1" followed by the commit subject in
> parentheses. This causes checkpatch to trigger false positive errors.
>
> ERROR: Please use git commit description style 'commit <12+ chars of sha1> (" ")'
> - ie: 'commit e9acda52fd2e ("bonding: fix use-after-free due to enslave fail after slave array update")
> #9:
> [ Upstream commit e9acda52fd2ee0cdca332f996da7a95c5fd25294 ]
>
> Add validation to ensure these tags use the required 40-hex-character
> SHA1 and provide a warning if the format is malformed. For example:
>
> WARNING: Malformed 'commit ... upstream.' line - expected 'commit <40 hex chars SHA1> upstream.'
> #7:
> commit e9acda5 upstream.
>
> WARNING: Malformed '[ Upstream commit ]' line - expected '[ Upstream commit <40 hex chars SHA1> ]'
> #7:
> [ Upstream commit e9acda5 ]
>
> Link: https://docs.kernel.org/process/stable-kernel-rules.html#option-3
> Signed-off-by: Yunseong Kim <yunseong.kim@est.tech>
> ---
> scripts/checkpatch.pl | 22 +++++++++++++++++++++-
> 1 file changed, 21 insertions(+), 1 deletion(-)

This should not be needed, you should not need to run checkpatch on a
stable backport, as you will get quickly confused by any issues that are
in the original patch.

We take many different styles of backports for stable kernels, but yours
was just wrong, with the incorrect authorship information, which
checkpatch would not have caught. Otherwise it would have been accepted
as-is.

thanks,

greg k-h