linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux-next] tools:signal: fix boolreturn.cocci warnings
@ 2021-08-24  6:51 CGEL
  2021-08-24 14:39 ` Shuah Khan
  0 siblings, 1 reply; 3+ messages in thread
From: CGEL @ 2021-08-24  6:51 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Will Deacon, Shuah Khan, linux-arm-kernel, linux-kselftest,
	linux-kernel, Jing Yangyang, Zeal Robot

From: Jing Yangyang <jing.yangyang@zte.com.cn>

./tools/testing/selftests/arm64/signal/test_signals_utils.h:112:9-10
WARNING: return of 0/1 in function 'get_current_context' with
return type bool

Return statements in functions returning bool should use true/false
instead of 1/0.

Generated by: scripts/coccinelle/misc/boolreturn.cocci

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Jing Yangyang <jing.yangyang@zte.com.cn>
---
 tools/testing/selftests/arm64/signal/test_signals_utils.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/arm64/signal/test_signals_utils.h b/tools/testing/selftests/arm64/signal/test_signals_utils.h
index 6772b5c..66122e6 100644
--- a/tools/testing/selftests/arm64/signal/test_signals_utils.h
+++ b/tools/testing/selftests/arm64/signal/test_signals_utils.h
@@ -109,7 +109,7 @@ static __always_inline bool get_current_context(struct tdescr *td,
 	if (seen_already) {
 		fprintf(stdout,
 			"Unexpected successful sigreturn detected: live_uc is stale !\n");
-		return 0;
+		return false;
 	}
 	seen_already = 1;
 
-- 
1.8.3.1



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

* Re: [PATCH linux-next] tools:signal: fix boolreturn.cocci warnings
  2021-08-24  6:51 [PATCH linux-next] tools:signal: fix boolreturn.cocci warnings CGEL
@ 2021-08-24 14:39 ` Shuah Khan
  2021-08-25 20:04   ` Shuah Khan
  0 siblings, 1 reply; 3+ messages in thread
From: Shuah Khan @ 2021-08-24 14:39 UTC (permalink / raw)
  To: CGEL, Catalin Marinas
  Cc: Will Deacon, Shuah Khan, linux-arm-kernel, linux-kselftest,
	linux-kernel, Jing Yangyang, Zeal Robot, Shuah Khan

On 8/24/21 12:51 AM, CGEL wrote:
> From: Jing Yangyang <jing.yangyang@zte.com.cn>
> 
> ./tools/testing/selftests/arm64/signal/test_signals_utils.h:112:9-10
> WARNING: return of 0/1 in function 'get_current_context' with
> return type bool
> 
> Return statements in functions returning bool should use true/false
> instead of 1/0.
> 
> Generated by: scripts/coccinelle/misc/boolreturn.cocci
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Jing Yangyang <jing.yangyang@zte.com.cn>
> ---
>   tools/testing/selftests/arm64/signal/test_signals_utils.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/arm64/signal/test_signals_utils.h b/tools/testing/selftests/arm64/signal/test_signals_utils.h
> index 6772b5c..66122e6 100644
> --- a/tools/testing/selftests/arm64/signal/test_signals_utils.h
> +++ b/tools/testing/selftests/arm64/signal/test_signals_utils.h
> @@ -109,7 +109,7 @@ static __always_inline bool get_current_context(struct tdescr *td,
>   	if (seen_already) {
>   		fprintf(stdout,
>   			"Unexpected successful sigreturn detected: live_uc is stale !\n");
> -		return 0;
> +		return false;
>   	}
>   	seen_already = 1;
>   
> 

We can't accept this patch. The from and Signed-off-by don't match.

thanks,
-- Shuah

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

* Re: [PATCH linux-next] tools:signal: fix boolreturn.cocci warnings
  2021-08-24 14:39 ` Shuah Khan
@ 2021-08-25 20:04   ` Shuah Khan
  0 siblings, 0 replies; 3+ messages in thread
From: Shuah Khan @ 2021-08-25 20:04 UTC (permalink / raw)
  To: CGEL, Catalin Marinas
  Cc: Will Deacon, Shuah Khan, linux-arm-kernel, linux-kselftest,
	linux-kernel, Jing Yangyang, Zeal Robot, Shuah Khan

On 8/24/21 8:39 AM, Shuah Khan wrote:
> On 8/24/21 12:51 AM, CGEL wrote:
>> From: Jing Yangyang <jing.yangyang@zte.com.cn>
>>
>> ./tools/testing/selftests/arm64/signal/test_signals_utils.h:112:9-10
>> WARNING: return of 0/1 in function 'get_current_context' with
>> return type bool
>>
>> Return statements in functions returning bool should use true/false
>> instead of 1/0.
>>
>> Generated by: scripts/coccinelle/misc/boolreturn.cocci
>>
>> Reported-by: Zeal Robot <zealci@zte.com.cn>
>> Signed-off-by: Jing Yangyang <jing.yangyang@zte.com.cn>
>> ---
>>   tools/testing/selftests/arm64/signal/test_signals_utils.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/arm64/signal/test_signals_utils.h b/tools/testing/selftests/arm64/signal/test_signals_utils.h
>> index 6772b5c..66122e6 100644
>> --- a/tools/testing/selftests/arm64/signal/test_signals_utils.h
>> +++ b/tools/testing/selftests/arm64/signal/test_signals_utils.h
>> @@ -109,7 +109,7 @@ static __always_inline bool get_current_context(struct tdescr *td,
>>       if (seen_already) {
>>           fprintf(stdout,
>>               "Unexpected successful sigreturn detected: live_uc is stale !\n");
>> -        return 0;
>> +        return false;

The change is fine. However, the function doc references to return 1/0
needs updates as well.

  * 1. grab a valid sigcontext into td->live_uc for result analysis: in
  * such case it returns 1.
  *
  * 2. detect if, somehow, a previously grabbed live_uc context has been
  * used actively with a sigreturn: in such a case the execution would have
  * magically resumed in the middle of this function itself (seen_already==1):
  * in such a case return 0, since in fact we have not just simply grabbed
  * the context.

thanks,
-- Shuah

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

end of thread, other threads:[~2021-08-25 20:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24  6:51 [PATCH linux-next] tools:signal: fix boolreturn.cocci warnings CGEL
2021-08-24 14:39 ` Shuah Khan
2021-08-25 20:04   ` Shuah Khan

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).