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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZrX9G2Ol2jt4o-s7@smile.fi.intel.com>
Date: Fri, 9 Aug 2024 14:27:23 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Zijun Hu <zijun_hu@...oud.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Jason Gunthorpe <jgg@...pe.ca>,
	Sakari Ailus <sakari.ailus@...ux.intel.com>,
	"Matthew Wilcox (Oracle)" <willy@...radead.org>,
	"Rafael J. Wysocki" <rafael@...nel.org>,
	linux-kernel@...r.kernel.org, Zijun Hu <quic_zijuhu@...cinc.com>
Subject: Re: [PATCH] linux/container_of.h: Remove redundant type cast in
 container_of_const()

On Fri, Aug 02, 2024 at 11:15:15PM +0800, Zijun Hu wrote:
> From: Zijun Hu <quic_zijuhu@...cinc.com>
> 
> Remove redundant (type *) cast for default branch in container_of_const()
> since the cast has been done by container_of().

While it might have same effect, the below is explicitly clear about both
cases. With your patch it will become inconsistent.

...

>  #define container_of_const(ptr, type, member)				\
>  	_Generic(ptr,							\
>  		const typeof(*(ptr)) *: ((const type *)container_of(ptr, type, member)),\

(see, in the above line the cast is still present / required)

> -		default: ((type *)container_of(ptr, type, member))	\
> +		default: container_of(ptr, type, member)	\
>  	)

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ