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: <ce7e62fa-5b5a-66c6-2154-31f99e9dfaca@intel.com>
Date:   Thu, 1 Dec 2022 12:25:32 -0800
From:   Russ Weight <russell.h.weight@...el.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        <linux-kernel@...r.kernel.org>
CC:     Luis Chamberlain <mcgrof@...nel.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>
Subject: Re: [PATCH 4/4] firmware_loader: fix up to_fw_sysfs() to preserve
 const



On 12/1/22 11:30, Greg Kroah-Hartman 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: Russ Weight <russell.h.weight@...el.com>
> Cc: "Rafael J. Wysocki" <rafael@...nel.org>
> Fixes: 23680f0b7d7f ("driver core: make struct class.dev_uevent() take a const *")
Acked-by: Russ Weight <russell.h.weight@...el.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> ---
>  drivers/base/firmware_loader/sysfs.h | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/base/firmware_loader/sysfs.h b/drivers/base/firmware_loader/sysfs.h
> index fd0b4ad9bdbb..0f0b1f7bf335 100644
> --- a/drivers/base/firmware_loader/sysfs.h
> +++ b/drivers/base/firmware_loader/sysfs.h
> @@ -80,11 +80,8 @@ 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(struct device, __dev, struct fw_sysfs, dev)
>  
>  void __fw_load_abort(struct fw_priv *fw_priv);
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ