netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] connector: Fix invalid conversion in cn_proc.h
@ 2024-05-10 15:49 Matt Jan
  2024-05-14  0:53 ` Jakub Kicinski
  0 siblings, 1 reply; 4+ messages in thread
From: Matt Jan @ 2024-05-10 15:49 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, netdev; +Cc: linux-kernel, Matt Jan, Matt Jan

From: Matt Jan <matt_jan@trendmicro.com>

The implicit conversion from unsigned int to enum
proc_cn_event is invalid, so explicitly cast it
for compilation in a C++ compiler.
/usr/include/linux/cn_proc.h: In function 'proc_cn_event valid_event(proc_cn_event)':
/usr/include/linux/cn_proc.h:72:17: error: invalid conversion from 'unsigned int' to 'proc_cn_event' [-fpermissive]
   72 |         ev_type &= PROC_EVENT_ALL;
      |                 ^
      |                 |
      |                 unsigned int

Signed-off-by: Matt Jan <zoo868e@gmail.com>
---
 include/uapi/linux/cn_proc.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/uapi/linux/cn_proc.h b/include/uapi/linux/cn_proc.h
index f2afb7cc4926..22f9419498ca 100644
--- a/include/uapi/linux/cn_proc.h
+++ b/include/uapi/linux/cn_proc.h
@@ -69,8 +69,7 @@ struct proc_input {
 
 static inline enum proc_cn_event valid_event(enum proc_cn_event ev_type)
 {
-	ev_type &= PROC_EVENT_ALL;
-	return ev_type;
+	return (enum proc_cn_event) (ev_type & PROC_EVENT_ALL);
 }
 
 /*
-- 
2.25.1


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

* Re: [PATCH] connector: Fix invalid conversion in cn_proc.h
  2024-05-10 15:49 [PATCH] connector: Fix invalid conversion in cn_proc.h Matt Jan
@ 2024-05-14  0:53 ` Jakub Kicinski
  2024-05-14  4:10   ` [PATCH v2] " Matt Jan
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2024-05-14  0:53 UTC (permalink / raw)
  To: Matt Jan; +Cc: davem, edumazet, pabeni, netdev, linux-kernel, Matt Jan

On Fri, 10 May 2024 23:49:19 +0800 Matt Jan wrote:
> From: Matt Jan <matt_jan@trendmicro.com>
> 
> The implicit conversion from unsigned int to enum
> proc_cn_event is invalid, so explicitly cast it
> for compilation in a C++ compiler.
> /usr/include/linux/cn_proc.h: In function 'proc_cn_event valid_event(proc_cn_event)':
> /usr/include/linux/cn_proc.h:72:17: error: invalid conversion from 'unsigned int' to 'proc_cn_event' [-fpermissive]
>    72 |         ev_type &= PROC_EVENT_ALL;
>       |                 ^
>       |                 |
>       |                 unsigned int
> 
> Signed-off-by: Matt Jan <zoo868e@gmail.com>

Why not. But please fix the checkpatch warning:

CHECK: No space is necessary after a cast
#36: FILE: include/uapi/linux/cn_proc.h:72:
+	return (enum proc_cn_event) (ev_type & PROC_EVENT_ALL);
-- 
pw-bot: cr

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

* [PATCH v2] connector: Fix invalid conversion in cn_proc.h
  2024-05-14  0:53 ` Jakub Kicinski
@ 2024-05-14  4:10   ` Matt Jan
  2024-05-24  9:40     ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 4+ messages in thread
From: Matt Jan @ 2024-05-14  4:10 UTC (permalink / raw)
  To: kuba; +Cc: davem, edumazet, linux-kernel, matt_jan, netdev, pabeni, zoo868e

The implicit conversion from unsigned int to enum
proc_cn_event is invalid, so explicitly cast it
for compilation in a C++ compiler.
/usr/include/linux/cn_proc.h: In function 'proc_cn_event valid_event(proc_cn_event)':
/usr/include/linux/cn_proc.h:72:17: error: invalid conversion from 'unsigned int' to 'proc_cn_event' [-fpermissive]
   72 |         ev_type &= PROC_EVENT_ALL;
      |                 ^
      |                 |
      |                 unsigned int

Signed-off-by: Matt Jan <zoo868e@gmail.com>
---
change in v2:
	fix: remove space after cast

 include/uapi/linux/cn_proc.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/uapi/linux/cn_proc.h b/include/uapi/linux/cn_proc.h
index f2afb7cc4926..18e3745b86cd 100644
--- a/include/uapi/linux/cn_proc.h
+++ b/include/uapi/linux/cn_proc.h
@@ -69,8 +69,7 @@ struct proc_input {
 
 static inline enum proc_cn_event valid_event(enum proc_cn_event ev_type)
 {
-	ev_type &= PROC_EVENT_ALL;
-	return ev_type;
+	return (enum proc_cn_event)(ev_type & PROC_EVENT_ALL);
 }
 
 /*
-- 
2.25.1


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

* Re: [PATCH v2] connector: Fix invalid conversion in cn_proc.h
  2024-05-14  4:10   ` [PATCH v2] " Matt Jan
@ 2024-05-24  9:40     ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-05-24  9:40 UTC (permalink / raw)
  To: Matt Jan; +Cc: kuba, davem, edumazet, linux-kernel, matt_jan, netdev, pabeni

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Tue, 14 May 2024 12:10:46 +0800 you wrote:
> The implicit conversion from unsigned int to enum
> proc_cn_event is invalid, so explicitly cast it
> for compilation in a C++ compiler.
> /usr/include/linux/cn_proc.h: In function 'proc_cn_event valid_event(proc_cn_event)':
> /usr/include/linux/cn_proc.h:72:17: error: invalid conversion from 'unsigned int' to 'proc_cn_event' [-fpermissive]
>    72 |         ev_type &= PROC_EVENT_ALL;
>       |                 ^
>       |                 |
>       |                 unsigned int
> 
> [...]

Here is the summary with links:
  - [v2] connector: Fix invalid conversion in cn_proc.h
    https://git.kernel.org/netdev/net/c/06e785aeb9ea

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-05-24  9:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-10 15:49 [PATCH] connector: Fix invalid conversion in cn_proc.h Matt Jan
2024-05-14  0:53 ` Jakub Kicinski
2024-05-14  4:10   ` [PATCH v2] " Matt Jan
2024-05-24  9:40     ` patchwork-bot+netdevbpf

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