lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Tue, 23 Jan 2024 13:16:46 +0300
From: Alexey Dobriyan <adobriyan@...il.com>
To: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
	pabeni@...hat.com
Cc: netdev@...r.kernel.org
Subject: [PATCH 2/2] connector, linux++: fix <uapi/linux/cn_proc.h> header

Rules around enums are stricter in C++, they decay to ints just as
easily but don't convert back to enums:

	#define PROC_EVENT_ALL (PROC_EVENT_FORK|...)
	enum proc_cn_event ev_type;
	ev_type &= PROC_EVENT_ALL;

main.cc: In function ‘proc_cn_event valid_event(proc_cn_event)’:
main.cc:91:17: error: invalid conversion from ‘unsigned int’ to ‘proc_cn_event’ [-fpermissive]
   91 |         ev_type &= PROC_EVENT_ALL;
      |                 ^
      |                 |
      |                 unsigned int

Use casts so that both C and C++ compilers are satisfied.

Signed-off-by: Alexey Dobriyan <adobriyan@...il.com>
---

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

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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ