linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] checkpatch: add fix for BAD_SIGN_OFF
@ 2020-11-08 13:43 Aditya Srivastava
  2020-11-08 19:57 ` Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: Aditya Srivastava @ 2020-11-08 13:43 UTC (permalink / raw)
  To: joe
  Cc: yashsri421, lukas.bulwahn, dwaipayanray1, linux-kernel-mentees,
	linux-kernel

Currently, checkpatch warns us if the author of the commit signs-off
as co-developed-by.
E.g. for commit 6e88559470f5 ("Documentation: Add section about
CPU vulnerabilities for Spectre") we get:

WARNING: Co-developed-by: should not be used to attribute nominal
patch author 'Tim Chen <tim.c.chen@linux.intel.com>'
Co-developed-by: Tim Chen <tim.c.chen@linux.intel.com>

Provide a simple fix by removing the co-developed-by line from the
commit message

A quick evaluation on v4.13..v5.8 showed that this fix was getting
triggered 6 times.
A quick manual check found out that all fixes were correct in those
cases.

Signed-off-by: Aditya Srivastava <yashsri421@gmail.com>
---
 scripts/checkpatch.pl | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 58095d9d8f34..1030d4fc2abf 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2827,8 +2827,11 @@ sub process {
 # Check Co-developed-by: immediately followed by Signed-off-by: with same name and email
 			if ($sign_off =~ /^co-developed-by:$/i) {
 				if ($email eq $author) {
-					WARN("BAD_SIGN_OFF",
-					      "Co-developed-by: should not be used to attribute nominal patch author '$author'\n" . "$here\n" . $rawline);
+					if (WARN("BAD_SIGN_OFF",
+						 "Co-developed-by: should not be used to attribute nominal patch author '$author'\n" . "$here\n" . $rawline) &&
+					    $fix) {
+						fix_delete_line($fixlinenr, $rawline);
+					}
 				}
 				if (!defined $lines[$linenr]) {
 					WARN("BAD_SIGN_OFF",
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] checkpatch: add fix for BAD_SIGN_OFF
  2020-11-08 13:43 [PATCH] checkpatch: add fix for BAD_SIGN_OFF Aditya Srivastava
@ 2020-11-08 19:57 ` Joe Perches
  2020-11-09  7:24   ` Aditya
  2020-12-04 10:06   ` Aditya
  0 siblings, 2 replies; 4+ messages in thread
From: Joe Perches @ 2020-11-08 19:57 UTC (permalink / raw)
  To: Aditya Srivastava
  Cc: lukas.bulwahn, dwaipayanray1, linux-kernel-mentees, linux-kernel

On Sun, 2020-11-08 at 19:13 +0530, Aditya Srivastava wrote:
> Currently, checkpatch warns us if the author of the commit signs-off
> as co-developed-by.
[]
> A quick manual check found out that all fixes were correct in those
> cases.
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -2827,8 +2827,11 @@ sub process {
>  # Check Co-developed-by: immediately followed by Signed-off-by: with same name and email
>  			if ($sign_off =~ /^co-developed-by:$/i) {
>  				if ($email eq $author) {
> -					WARN("BAD_SIGN_OFF",
> -					      "Co-developed-by: should not be used to attribute nominal patch author '$author'\n" . "$here\n" . $rawline);
> +					if (WARN("BAD_SIGN_OFF",
> +						 "Co-developed-by: should not be used to attribute nominal patch author '$author'\n" . "$here\n" . $rawline) &&
> +					    $fix) {
> +						fix_delete_line($fixlinenr, $rawline);
> +					}
>  				}
>  				if (!defined $lines[$linenr]) {
>  					WARN("BAD_SIGN_OFF",

Looks OK to me.

Another option might be to add a Signed-off-by: line derived from
any "From:" line when:

	if ($is_patch && $has_commit_log && $chk_signoff) {
		if ($signoff == 0) {
			ERROR("MISSING_SIGN_OFF",
			      "Missing Signed-off-by: line(s)\n");

etc...


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] checkpatch: add fix for BAD_SIGN_OFF
  2020-11-08 19:57 ` Joe Perches
@ 2020-11-09  7:24   ` Aditya
  2020-12-04 10:06   ` Aditya
  1 sibling, 0 replies; 4+ messages in thread
From: Aditya @ 2020-11-09  7:24 UTC (permalink / raw)
  To: Joe Perches
  Cc: lukas.bulwahn, dwaipayanray1, linux-kernel-mentees, linux-kernel

On 9/11/20 1:27 am, Joe Perches wrote:
> On Sun, 2020-11-08 at 19:13 +0530, Aditya Srivastava wrote:
>> Currently, checkpatch warns us if the author of the commit signs-off
>> as co-developed-by.
> []
>> A quick manual check found out that all fixes were correct in those
>> cases.
> []
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
>> @@ -2827,8 +2827,11 @@ sub process {
>>  # Check Co-developed-by: immediately followed by Signed-off-by: with same name and email
>>  			if ($sign_off =~ /^co-developed-by:$/i) {
>>  				if ($email eq $author) {
>> -					WARN("BAD_SIGN_OFF",
>> -					      "Co-developed-by: should not be used to attribute nominal patch author '$author'\n" . "$here\n" . $rawline);
>> +					if (WARN("BAD_SIGN_OFF",
>> +						 "Co-developed-by: should not be used to attribute nominal patch author '$author'\n" . "$here\n" . $rawline) &&
>> +					    $fix) {
>> +						fix_delete_line($fixlinenr, $rawline);
>> +					}
>>  				}
>>  				if (!defined $lines[$linenr]) {
>>  					WARN("BAD_SIGN_OFF",
> 
> Looks OK to me.
> 
> Another option might be to add a Signed-off-by: line derived from
> any "From:" line when:
> 
> 	if ($is_patch && $has_commit_log && $chk_signoff) {
> 		if ($signoff == 0) {
> 			ERROR("MISSING_SIGN_OFF",
> 			      "Missing Signed-off-by: line(s)\n");
> 
> etc...
> 

Yes, I just noticed. Thanks for the suggestion. Will do.

Thanks
Aditya

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] checkpatch: add fix for BAD_SIGN_OFF
  2020-11-08 19:57 ` Joe Perches
  2020-11-09  7:24   ` Aditya
@ 2020-12-04 10:06   ` Aditya
  1 sibling, 0 replies; 4+ messages in thread
From: Aditya @ 2020-12-04 10:06 UTC (permalink / raw)
  To: Joe Perches
  Cc: lukas.bulwahn, dwaipayanray1, linux-kernel-mentees, linux-kernel

On 9/11/20 1:27 am, Joe Perches wrote:
> On Sun, 2020-11-08 at 19:13 +0530, Aditya Srivastava wrote:
>> Currently, checkpatch warns us if the author of the commit signs-off
>> as co-developed-by.
> []
>> A quick manual check found out that all fixes were correct in those
>> cases.
> []
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
>> @@ -2827,8 +2827,11 @@ sub process {
>>  # Check Co-developed-by: immediately followed by Signed-off-by: with same name and email
>>  			if ($sign_off =~ /^co-developed-by:$/i) {
>>  				if ($email eq $author) {
>> -					WARN("BAD_SIGN_OFF",
>> -					      "Co-developed-by: should not be used to attribute nominal patch author '$author'\n" . "$here\n" . $rawline);
>> +					if (WARN("BAD_SIGN_OFF",
>> +						 "Co-developed-by: should not be used to attribute nominal patch author '$author'\n" . "$here\n" . $rawline) &&
>> +					    $fix) {
>> +						fix_delete_line($fixlinenr, $rawline);
>> +					}
>>  				}
>>  				if (!defined $lines[$linenr]) {
>>  					WARN("BAD_SIGN_OFF",
> 
> Looks OK to me.
> 
> Another option might be to add a Signed-off-by: line derived from
> any "From:" line when:
> 
> 	if ($is_patch && $has_commit_log && $chk_signoff) {
> 		if ($signoff == 0) {
> 			ERROR("MISSING_SIGN_OFF",
> 			      "Missing Signed-off-by: line(s)\n");
> 
> etc...
> 

Hi Joe

You probably forgot to Ack this patch.

Thanks
Aditya

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-04 10:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-08 13:43 [PATCH] checkpatch: add fix for BAD_SIGN_OFF Aditya Srivastava
2020-11-08 19:57 ` Joe Perches
2020-11-09  7:24   ` Aditya
2020-12-04 10:06   ` Aditya

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).