connector: Fix invalid conversion in cn_proc.h
Subsystems (2)
PATCH 1/1 connector: Fix invalid conversion in cn_proc.h
From: Matt Jan <[email protected]>
The implicit conversion from unsigned int to enumproc_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--- include/uapi/linux/cn_proc.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
include/uapi/linux/cn_proc.h +1 -2
@@ -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 ); }/*
Signature · 1 line
2.25.1
Jakub Kicinski
maintainerQuoted 7 lines · On Fri, 10 May 2024 23:49:19 +0800 Matt Jan wrote:
From: Matt Jan <[email protected]>
The implicit conversion from unsigned int to enum
proc_cn_eventis invalid, so explicitly cast it
for compilation in a C++ compiler./usr/include/linux/cn_proc.h: In function 'proc_cn_eventvalid_event(proc_cn_event)':/usr/include/linux/cn_proc.h:72:17: error: invalid conversion from 'unsigned int' to 'proc_cn_event' [-fpermissive]
Quoted 6 lines
72 | ev_type &= PROC_EVENT_ALL; | ^ | | | unsigned intSigned-off-by Matt Jan <[email protected]>
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);
Signature · 1 line
pw-bot: cr
PATCH v2 1/1 connector: Fix invalid conversion in cn_proc.h
The implicit conversion from unsigned int to enumproc_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---
change in v2:
fix: remove space after cast
include/uapi/linux/cn_proc.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
include/uapi/linux/cn_proc.h +1 -2
@@ -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 ); }/*
Signature · 1 line
2.25.1
This patch was applied to netdev/net.git (main) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:
Quoted 11 lines · On Tue, 14 May 2024 12:10:46 +0800 you wrote:
The implicit conversion from unsigned int to enum
proc_cn_eventis invalid, so explicitly cast it
for compilation in a C++ compiler./usr/include/linux/cn_proc.h: In function 'proc_cn_eventvalid_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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html