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: <2024070424-deplete-dangling-bcc6@gregkh>
Date: Thu, 4 Jul 2024 12:34:00 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Zijun Hu <quic_zijuhu@...cinc.com>
Cc: linux-kernel@...r.kernel.org, rafael@...nel.org, brgl@...ev.pl,
	madalin.bucur@....com, davem@...emloft.net,
	andriy.shevchenko@...ux.intel.com
Subject: Re: [PATCH v1 4/5] devres: Simplify devm_percpu_match()
 implementation

On Tue, Jul 02, 2024 at 10:51:53PM +0800, Zijun Hu wrote:
> Simplify devm_percpu_match() implementation by removing redundant
> conversions.
> 
> Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
> ---
> Previous discussion link:
> https://lore.kernel.org/lkml/1719496036-24642-1-git-send-email-quic_zijuhu@quicinc.com/
> 
> Changes since the original one:
>  - Select the simplier solution
> 
>  drivers/base/devres.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/base/devres.c b/drivers/base/devres.c
> index e9b0d94aeabd..2ad6dacb3472 100644
> --- a/drivers/base/devres.c
> +++ b/drivers/base/devres.c
> @@ -1176,9 +1176,8 @@ static void devm_percpu_release(struct device *dev, void *pdata)
>  
>  static int devm_percpu_match(struct device *dev, void *data, void *p)
>  {
> -	struct devres *devr = container_of(data, struct devres, data);
> -
> -	return *(void **)devr->data == p;
> +	/* @data is already and must be (void *)devr->data */
> +	return *(void **)data == p;

The compiler output should be identical here, right?  And container_of()
enforces the placement so I'd prefer the original here as a comment
isn't going to enforce anything :)

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ