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: <20250811085731.2117377-1-sakari.ailus@linux.intel.com>
Date: Mon, 11 Aug 2025 11:57:31 +0300
From: Sakari Ailus <sakari.ailus@...ux.intel.com>
To: linux-kernel@...r.kernel.org
Cc: Andy Whitcroft <apw@...onical.com>,
	Joe Perches <joe@...ches.com>,
	Dwaipayan Ray <dwaipayanray1@...il.com>,
	Lukas Bulwahn <lukas.bulwahn@...il.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: [PATCH 1/1] checkpatch: Deprecate container_of() in favour of container_of_const()

container_of() discards constness of its first argument and thus its use
may result in inadvertly unconstifying an object that is const. While
container_of_const() addresses this problem, the vast majority of new uses
of the two use the container_of() variant lacking the check.

Stem the flow of new container_of() use by adding it to the list of
deprecated functions in scripts/checkpatch.pl. Once all existing
container_of() users have been fixed to respect the constness attribute,
the check can be added to container_of() and we can switch back to
container_of() again.

Signed-off-by: Sakari Ailus <sakari.ailus@...ux.intel.com>
---
 scripts/checkpatch.pl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 664f7b7a622c..32edebfc1935 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -859,6 +859,7 @@ our %deprecated_apis = (
 	"kunmap_atomic"				=> "kunmap_local",
 	"srcu_read_lock_lite"			=> "srcu_read_lock_fast",
 	"srcu_read_unlock_lite"			=> "srcu_read_unlock_fast",
+	"container_of"				=> "container_of_const",
 );
 
 #Create a search pattern for all these strings to speed up a loop below
-- 
2.39.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ