linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] mm/usercopy: fix warning Comparison to bool
@ 2020-04-14  3:42 Zou Wei
  2020-04-15 23:04 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Zou Wei @ 2020-04-14  3:42 UTC (permalink / raw)
  To: akpm, linux-mm, linux-kernel; +Cc: Zou Wei

fix below warnings reported by coccicheck

mm/usercopy.c:304:5-18: WARNING: Comparison to bool

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
---
 mm/usercopy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/usercopy.c b/mm/usercopy.c
index 660717a..04346cf 100644
--- a/mm/usercopy.c
+++ b/mm/usercopy.c
@@ -301,7 +301,7 @@ __setup("hardened_usercopy=", parse_hardened_usercopy);
 
 static int __init set_hardened_usercopy(void)
 {
-	if (enable_checks == false)
+	if (!enable_checks)
 		static_branch_enable(&bypass_usercopy_checks);
 	return 1;
 }
-- 
2.6.2


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

* Re: [PATCH -next] mm/usercopy: fix warning Comparison to bool
  2020-04-14  3:42 [PATCH -next] mm/usercopy: fix warning Comparison to bool Zou Wei
@ 2020-04-15 23:04 ` Andrew Morton
  2020-04-16 10:45   ` 答复: " Zouwei (Samuel)
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2020-04-15 23:04 UTC (permalink / raw)
  To: Zou Wei; +Cc: linux-mm, linux-kernel

On Tue, 14 Apr 2020 11:42:04 +0800 Zou Wei <zou_wei@huawei.com> wrote:

> fix below warnings reported by coccicheck
> 
> mm/usercopy.c:304:5-18: WARNING: Comparison to bool
>
> ...
>
> --- a/mm/usercopy.c
> +++ b/mm/usercopy.c
> @@ -301,7 +301,7 @@ __setup("hardened_usercopy=", parse_hardened_usercopy);
>  
>  static int __init set_hardened_usercopy(void)
>  {
> -	if (enable_checks == false)
> +	if (!enable_checks)
>  		static_branch_enable(&bypass_usercopy_checks);
>  	return 1;
>  }

My initial reaction is "fix coccicheck".  There's nothing wrong with
that code?


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

* 答复: [PATCH -next] mm/usercopy: fix warning Comparison to bool
  2020-04-15 23:04 ` Andrew Morton
@ 2020-04-16 10:45   ` Zouwei (Samuel)
  2020-04-16 11:23     ` David Hildenbrand
  0 siblings, 1 reply; 4+ messages in thread
From: Zouwei (Samuel) @ 2020-04-16 10:45 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, linux-kernel

Hi Andrew,

Thanks for your reply.
Perhaps this is a detection rule of Coccinelle (coccicheck) software for programming specifications,
and it's no wrong with the code, just a coding style.

Best Regards
Zou Wei
-----邮件原件-----
发件人: Andrew Morton [mailto:akpm@linux-foundation.org] 
发送时间: 2020年4月16日 7:05
收件人: Zouwei (Samuel) <zou_wei@huawei.com>
抄送: linux-mm@kvack.org; linux-kernel@vger.kernel.org
主题: Re: [PATCH -next] mm/usercopy: fix warning Comparison to bool

On Tue, 14 Apr 2020 11:42:04 +0800 Zou Wei <zou_wei@huawei.com> wrote:

> fix below warnings reported by coccicheck
> 
> mm/usercopy.c:304:5-18: WARNING: Comparison to bool
>
> ...
>
> --- a/mm/usercopy.c
> +++ b/mm/usercopy.c
> @@ -301,7 +301,7 @@ __setup("hardened_usercopy=", 
> parse_hardened_usercopy);
>  
>  static int __init set_hardened_usercopy(void)  {
> -	if (enable_checks == false)
> +	if (!enable_checks)
>  		static_branch_enable(&bypass_usercopy_checks);
>  	return 1;
>  }

My initial reaction is "fix coccicheck".  There's nothing wrong with that code?


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

* Re: 答复: [PATCH -next] mm/usercopy: fix warning Comparison to bool
  2020-04-16 10:45   ` 答复: " Zouwei (Samuel)
@ 2020-04-16 11:23     ` David Hildenbrand
  0 siblings, 0 replies; 4+ messages in thread
From: David Hildenbrand @ 2020-04-16 11:23 UTC (permalink / raw)
  To: Zouwei (Samuel), Andrew Morton; +Cc: linux-mm, linux-kernel

On 16.04.20 12:45, Zouwei (Samuel) wrote:
> Hi Andrew,
> 
> Thanks for your reply.
> Perhaps this is a detection rule of Coccinelle (coccicheck) software for programming specifications,
> and it's no wrong with the code, just a coding style.

Then it's not an actual fix and the subject is misleading.

-- 
Thanks,

David / dhildenb


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

end of thread, other threads:[~2020-04-16 11:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-14  3:42 [PATCH -next] mm/usercopy: fix warning Comparison to bool Zou Wei
2020-04-15 23:04 ` Andrew Morton
2020-04-16 10:45   ` 答复: " Zouwei (Samuel)
2020-04-16 11:23     ` David Hildenbrand

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