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: <CAJZ5v0iBoitix-Y=wAO7x-Xzjm5KAb_W6sp03tT+cgEpwXE_fw@mail.gmail.com>
Date:   Mon, 5 Dec 2022 15:23:33 +0100
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org, Luis Chamberlain <mcgrof@...nel.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Jason Gunthorpe <jgg@...dia.com>,
        Russ Weight <russell.h.weight@...el.com>
Subject: Re: [PATCH v2 4/4] firmware_loader: fix up to_fw_sysfs() to preserve const

On Mon, Dec 5, 2022 at 1:12 PM Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
>
> to_fw_sysfs() was changed in commit 23680f0b7d7f ("driver core: make
> struct class.dev_uevent() take a const *") to pass in a const pointer
> but not pass it back out to handle some changes in the driver core.
> That isn't the best idea as it could cause problems if used incorrectly,
> so switch to use the container_of_const() macro instead which will
> preserve the const status of the pointer and enforce it by the compiler.
>
> Cc: Luis Chamberlain <mcgrof@...nel.org>
> Cc: "Rafael J. Wysocki" <rafael@...nel.org>
> Reviewed-by: Jason Gunthorpe <jgg@...dia.com>
> Acked-by: Russ Weight <russell.h.weight@...el.com>
> Fixes: 23680f0b7d7f ("driver core: make struct class.dev_uevent() take a const *")
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>

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

> ---
> v2: - respin with changed container_of_const() parameters
>
>  drivers/base/firmware_loader/sysfs.h | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/base/firmware_loader/sysfs.h b/drivers/base/firmware_loader/sysfs.h
> index fd0b4ad9bdbb..2060add8ef81 100644
> --- a/drivers/base/firmware_loader/sysfs.h
> +++ b/drivers/base/firmware_loader/sysfs.h
> @@ -80,11 +80,7 @@ struct fw_sysfs {
>         struct firmware *fw;
>         void *fw_upload_priv;
>  };
> -
> -static inline struct fw_sysfs *to_fw_sysfs(const struct device *dev)
> -{
> -       return container_of(dev, struct fw_sysfs, dev);
> -}
> +#define to_fw_sysfs(__dev)     container_of_const(__dev, struct fw_sysfs, dev)
>
>  void __fw_load_abort(struct fw_priv *fw_priv);
>
> --
> 2.38.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ