Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp197845pxb; Wed, 11 Nov 2020 01:05:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJyVgzhzedAsuN1RGprA/wUItOkvFTQkkSPqZoqnuKAIcfIAN1uogfXQ9uyQmW/8mcElHDCi X-Received: by 2002:a17:906:68d8:: with SMTP id y24mr25411951ejr.438.1605085503892; Wed, 11 Nov 2020 01:05:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605085503; cv=none; d=google.com; s=arc-20160816; b=FCVL7XeWiMCq4X2/xK9tco9/zN2Ts3YNz8UqQlVZVxKnu/t6NvGxXJWgBm5Jozbl7O JX/a4yPTASFAyAIJ8r4GOwbM57LOG3UnZrtQff4tUnQWNN4EFAJXmLJAlyHEGDFbzO7L FduxJzyKqJkcxpRMSg9Axml53oxydH68iSSaemyCBxceoXgiVZT/9f8KX4ZkvbFSVjZf p6E/OIb+H/XsD8LhPV6kOzTJGMTfoFl3/Qp5i4TvZxxBQlcCPWtWR1HzNEiH0O/B6ufe YEqBwyWhpve+aCIs3NLmADOsgGHrf50SUik2M/Hrb9uUqtFRSAsZTaupbPbVACiE5WLe ZpZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=ZvE414n0h/SmbnlBo0DI3+dcCiuwLX2TAnqhW16Qji4=; b=fVBcyX+XeTr4F8qKQaGhb27Ug4PW06F1QO1pRBWs22GXQhwldVXxsk0IMOEO/9+J2+ dRO0l4kJysrKBTHn1lzBlGORWrww8QM8i39B5tXOW3Hp80EMWZorNJO5/4L1kI81Q/X0 E3J4tt1G/oTzSrGK/d+KwNhPqgrfkYl3bLjMSMmoUH3G0XsUo13+ufRo7M/DC2qhJvOz RXbKT4AnTWQcCAop3MiJWsa3F8O0qIHdlIKoOpctWJ7Q2x+qMIBrtdV55GGvlxUqikrg W7uKbiHrRen5XvTWNp4Lu6D/3+kq9hulNuR7yz5tc03rDGJusP31AK7/Qt5sNyp2OWX4 Mgtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Dp8Mbx7d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x10si869515ejf.3.2020.11.11.01.04.36; Wed, 11 Nov 2020 01:05:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Dp8Mbx7d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726255AbgKKJBz (ORCPT + 99 others); Wed, 11 Nov 2020 04:01:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726236AbgKKJBy (ORCPT ); Wed, 11 Nov 2020 04:01:54 -0500 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BF5BC0613D1 for ; Wed, 11 Nov 2020 01:01:52 -0800 (PST) Received: by mail-pg1-x52a.google.com with SMTP id m13so1037032pgl.7 for ; Wed, 11 Nov 2020 01:01:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=ZvE414n0h/SmbnlBo0DI3+dcCiuwLX2TAnqhW16Qji4=; b=Dp8Mbx7dscApf3G52JFH1lkb+gNXx9FmiGHYXQ07t87qoFgVfSmJG2Z9Ky3KOuAugk lAp5oUhDFBIMStnb8+ZG5J1r4yTzpd050BRieOTOmnnbC3x4i+IsvlVCfCy5N9fm1EgS PY05bb2qAHCeQ0PG313qloVs7Ryfu8qlcIztbroU7EsBIZCGzRrqk9rbgkPgfMvOFhBm R++bvH1NMhSznuslyTvEmRhwWZ/ArdNnIb6ZDkTf/HvHg4mt+BvSeFsF/N9XgcpixrJ/ LHF1PgqcuJjCQ98Ze8ZFaTSlPpXZvl+0/Hz6ZZYuuMkGXQQnrdOBzFRul2fzpAqGWQi/ fYCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ZvE414n0h/SmbnlBo0DI3+dcCiuwLX2TAnqhW16Qji4=; b=Z0ceNTz1mTRcMcjqenuc8iy3dZwfiYKBkHKSOUU5EbqpzEetl1f5QqUZtr1EX1umrB GARn1EkFMI/f0qZNlPQIPV9L/uIsZ6StNie5EnhYE2SF3cBOZMJrdlSH+dp8htRd+Pff XHKZAX+lyc3K6ELZ1u7hswJC9SOCtia9QYiw3IkKyzFgfk58jFzCYh8QEVYZZNi8rIv3 juorT9yQJXUMtaZSQCbJGgVOEIzCB7uR+Mv0liYZ7bHlHe9hXSueRBrv8HWsHa+t4aZh 6UTXpqZIBW7QQ8gCzh/YYWRXLz+ofBdlymXinybwXP4A5iEcc0KuPssRnluiv3ywB9Cm kYMw== X-Gm-Message-State: AOAM532ADAN72VQ8467sS4ZgfdbT5SSQn81XScq1ESomsWwxxrTyGwsl E3maW9Zu+q4UvxSMLmTt2vfftHBmwIGRd7A6 X-Received: by 2002:aa7:9903:0:b029:18b:9271:a468 with SMTP id z3-20020aa799030000b029018b9271a468mr22324477pff.11.1605085311951; Wed, 11 Nov 2020 01:01:51 -0800 (PST) Received: from localhost.localdomain ([2402:3a80:41c:a166:90d7:ac69:6d50:789e]) by smtp.googlemail.com with ESMTPSA id ji2sm1682914pjb.35.2020.11.11.01.01.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 01:01:51 -0800 (PST) From: Aditya Srivastava To: joe@perches.com Cc: yashsri421@gmail.com, lukas.bulwahn@gmail.com, linux-kernel-mentees@lists.linuxfoundation.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] checkpatch: add fix option for MISSING_SIGN_OFF Date: Wed, 11 Nov 2020 14:31:43 +0530 Message-Id: <20201111090143.9230-1-yashsri421@gmail.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently checkpatch warns us if there is no 'Signed-off-by' line for the patch. E.g., running checkpatch on commit 9ac060a708e0 ("leaking_addresses: Completely remove --version flag") reports this error: ERROR: Missing Signed-off-by: line(s) Provide a fix by adding a Signed-off-by line corresponding to the author of the patch before the patch separator line. Also avoid this error for the commits where some typo is present in the sign off. E.g. for commit 8cde5d5f7361 ("bus: ti-sysc: Detect omap4 type timers for quirk") we get missing sign off as well as bad sign off for: Siganed-off-by: Tony Lindgren Here it is probably best to give BAD_SIGN_OFF warning for Non-standard signature and avoid MISSING_SIGN_OFF Suggested-by: Joe Perches Signed-off-by: Aditya Srivastava --- Changes in v2: Add space after 'if' Add check for $patch_separator_linenr to be greater than 0 scripts/checkpatch.pl | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index cb46288127ac..ac7e5ac80b58 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2404,6 +2404,8 @@ sub process { my $last_blank_line = 0; my $last_coalesced_string_linenr = -1; + my $patch_separator_linenr = 0; + my $non_standard_signature = 0; our @report = (); our $cnt_lines = 0; @@ -2755,6 +2757,10 @@ sub process { if ($line =~ /^---$/) { $has_patch_separator = 1; $in_commit_log = 0; + # to add missing sign off line before diff(s) + if ($patch_separator_linenr == 0) { + $patch_separator_linenr = $linenr; + } } # Check if MAINTAINERS is being updated. If so, there's probably no need to @@ -2775,6 +2781,9 @@ sub process { if ($sign_off !~ /$signature_tags/) { WARN("BAD_SIGN_OFF", "Non-standard signature: $sign_off\n" . $herecurr); + + # to avoid missing_sign_off error as it most probably is just a typo + $non_standard_signature = 1; } if (defined $space_before && $space_before ne "") { if (WARN("BAD_SIGN_OFF", @@ -7118,9 +7127,12 @@ sub process { "Does not appear to be a unified-diff format patch\n"); } if ($is_patch && $has_commit_log && $chk_signoff) { - if ($signoff == 0) { - ERROR("MISSING_SIGN_OFF", - "Missing Signed-off-by: line(s)\n"); + if ($signoff == 0 && !$non_standard_signature) { + if (ERROR("MISSING_SIGN_OFF", + "Missing Signed-off-by: line(s)\n") && + $fix && $patch_separator_linenr > 0) { + fix_insert_line($patch_separator_linenr - 1, "Signed-off-by: $author"); + } } elsif ($authorsignoff != 1) { # authorsignoff values: # 0 -> missing sign off -- 2.17.1