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: <CAJZ5v0hiqqKaBd3vDu74V9KwJY6J_w2iLuc_shb+C-LBaArxaA@mail.gmail.com>
Date:   Mon, 3 Apr 2023 19:57:01 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org, rafael@...nel.org
Subject: Re: [PATCH 2/5] driver core: class: make class_register() take a
 const *

On Sun, Apr 2, 2023 at 7:59 PM Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
>
> Now that the class code is cleaned up to not modify the class pointer
> registered with it, change class_register() to take a const * to allow
> the structure to be placed into read-only memory.
>
> Cc: "Rafael J. Wysocki" <rafael@...nel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>

Acked-by: Rafael J. Wysocki <rafael@...nel.org>

> ---
>  drivers/base/base.h          | 2 +-
>  drivers/base/class.c         | 6 +++---
>  include/linux/device/class.h | 2 +-
>  3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/base/base.h b/drivers/base/base.h
> index e96f3343fd7c..eb4c0ace9242 100644
> --- a/drivers/base/base.h
> +++ b/drivers/base/base.h
> @@ -54,7 +54,7 @@ struct subsys_private {
>         struct device *dev_root;
>
>         struct kset glue_dirs;
> -       struct class *class;
> +       const struct class *class;
>
>         struct lock_class_key lock_key;
>  };
> diff --git a/drivers/base/class.c b/drivers/base/class.c
> index 53fc7052340c..05bce79d3d19 100644
> --- a/drivers/base/class.c
> +++ b/drivers/base/class.c
> @@ -93,7 +93,7 @@ static ssize_t class_attr_store(struct kobject *kobj, struct attribute *attr,
>  static void class_release(struct kobject *kobj)
>  {
>         struct subsys_private *cp = to_subsys_private(kobj);
> -       struct class *class = cp->class;
> +       const struct class *class = cp->class;
>
>         pr_debug("class '%s': release.\n", class->name);
>
> @@ -110,7 +110,7 @@ static void class_release(struct kobject *kobj)
>  static const struct kobj_ns_type_operations *class_child_ns_type(const struct kobject *kobj)
>  {
>         const struct subsys_private *cp = to_subsys_private(kobj);
> -       struct class *class = cp->class;
> +       const struct class *class = cp->class;
>
>         return class->ns_type;
>  }
> @@ -175,7 +175,7 @@ static void klist_class_dev_put(struct klist_node *n)
>         put_device(dev);
>  }
>
> -int class_register(struct class *cls)
> +int class_register(const struct class *cls)
>  {
>         struct subsys_private *cp;
>         struct lock_class_key *key;
> diff --git a/include/linux/device/class.h b/include/linux/device/class.h
> index f3c418fa129a..4bf46f9bbb56 100644
> --- a/include/linux/device/class.h
> +++ b/include/linux/device/class.h
> @@ -76,7 +76,7 @@ struct class_dev_iter {
>         const struct device_type        *type;
>  };
>
> -int __must_check class_register(struct class *class);
> +int __must_check class_register(const struct class *class);
>  void class_unregister(const struct class *class);
>  bool class_is_registered(const struct class *class);
>
> --
> 2.40.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ