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] [day] [month] [year] [list]
Message-ID: <20251112150947.i6iionea3cqrpkxe@pacemaker>
Date: Wed, 12 Nov 2025 09:09:47 -0600
From: Nishanth Menon <nm@...com>
To: Adrian Barnaś <abarnas@...gle.com>
CC: Tero Kristo <kristo@...nel.org>, Santosh Shilimkar <ssantosh@...nel.org>,
	Michael Turquette <mturquette@...libre.com>, Stephen Boyd <sboyd@...nel.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
	<linux-clk@...r.kernel.org>
Subject: Re: [PATCH] clk: keystone: Fix discarded const qualifiers

On 16:16-20251028, Adrian Barnaś wrote:
> Add const qualifiers to the pointers returned from 'container_of' macro
> to prevent breaking the const promise on const struct pointers from
> parameters.
> 
> Once you have a mutable container structure pointer, you can change
> structure fields through it, which violates the const guarantee.
> 
> Signed-off-by: Adrian Barnaś <abarnas@...gle.com>
> ---
>  drivers/clk/keystone/sci-clk.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-clk.c
> index a4b42811de55..9d5071223f4c 100644
> --- a/drivers/clk/keystone/sci-clk.c
> +++ b/drivers/clk/keystone/sci-clk.c
> @@ -496,8 +496,8 @@ static int ti_sci_scan_clocks_from_fw(struct sci_clk_provider *provider)
>  static int _cmp_sci_clk_list(void *priv, const struct list_head *a,
>  			     const struct list_head *b)
>  {
> -	struct sci_clk *ca = container_of(a, struct sci_clk, node);
> -	struct sci_clk *cb = container_of(b, struct sci_clk, node);
> +	const struct sci_clk *ca = container_of(a, struct sci_clk, node);
> +	const struct sci_clk *cb = container_of(b, struct sci_clk, node);
>  
>  	return _cmp_sci_clk(ca, &cb);
>  }
> -- 
> 2.51.1.851.g4ebd6896fd-goog
> 
> 
Reviewed-by: Nishanth Menon <nm@...com>

-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
https://ti.com/opensource

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ