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]
Message-ID: <a088c95b-53d2-42ea-9eb3-ae81fbd07c1b@p183>
Date: Fri, 19 Jul 2024 22:19:37 +0300
From: Alexey Dobriyan <adobriyan@...il.com>
To: akpm@...ux-foundation.org
Cc: linux-kernel@...r.kernel.org, andriy.shevchenko@...ux.intel.com
Subject: [PATCH] simplify container_of_const()

* add necessary parenthesis so that

	container_of_const((expr1, expr2), T, member)

  compiles without warnings,

* delete unnecessary parenthesis,

* delete unnecessary cast:

	container_of(ptr, T, member)

  has type "T*" and doesn't need any more casts.

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

 include/linux/container_of.h |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/include/linux/container_of.h
+++ b/include/linux/container_of.h
@@ -30,9 +30,9 @@
  * @member:		the name of the member within the struct.
  */
 #define container_of_const(ptr, type, member)				\
-	_Generic(ptr,							\
-		const typeof(*(ptr)) *: ((const type *)container_of(ptr, type, member)),\
-		default: ((type *)container_of(ptr, type, member))	\
+	_Generic((ptr),							\
+		const typeof(*(ptr)) *: (const type *)container_of(ptr, type, member),\
+		default: container_of(ptr, type, member)		\
 	)
 
 #endif	/* _LINUX_CONTAINER_OF_H */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ