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: <20230111093327.3955063-1-gregkh@linuxfoundation.org>
Date:   Wed, 11 Jan 2023 10:33:27 +0100
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     linux-kernel@...r.kernel.org
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>
Subject: [PATCH] driver core: change to_subsys_private() to use container_of_const()

The macro to_subsys_private() needs to switch to using
container_of_const() as it turned out to being incorrectly casting a
const pointer to a non-const one.  Make this change and fix up the one
offending user to be correctly handling a const pointer properly.

Cc: "Rafael J. Wysocki" <rafael@...nel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
 drivers/base/base.h  | 2 +-
 drivers/base/class.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/base.h b/drivers/base/base.h
index 2e08258ce82e..3d1da1027206 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -53,7 +53,7 @@ struct subsys_private {
 	struct kset glue_dirs;
 	struct class *class;
 };
-#define to_subsys_private(obj) container_of(obj, struct subsys_private, subsys.kobj)
+#define to_subsys_private(obj) container_of_const(obj, struct subsys_private, subsys.kobj)
 
 struct driver_private {
 	struct kobject kobj;
diff --git a/drivers/base/class.c b/drivers/base/class.c
index 86ec554cfe60..3366da9c3ff6 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -64,7 +64,7 @@ static void class_release(struct kobject *kobj)
 
 static const struct kobj_ns_type_operations *class_child_ns_type(const struct kobject *kobj)
 {
-	struct subsys_private *cp = to_subsys_private(kobj);
+	const struct subsys_private *cp = to_subsys_private(kobj);
 	struct class *class = cp->class;
 
 	return class->ns_type;
-- 
2.39.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ