[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f057f74b-07fa-433d-b906-011186eb86a7@intel.com>
Date: Mon, 12 Aug 2024 14:54:47 +0200
From: Przemek Kitszel <przemyslaw.kitszel@...el.com>
To: Zijun Hu <zijun_hu@...oud.com>, Dan Williams <dan.j.williams@...el.com>
CC: <linux-kernel@...r.kernel.org>, <linux-cxl@...r.kernel.org>,
<linux1394-devel@...ts.sourceforge.net>, <netdev@...r.kernel.org>, Zijun Hu
<quic_zijuhu@...cinc.com>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>, Davidlohr Bueso <dave@...olabs.net>,
Jonathan Cameron <jonathan.cameron@...wei.com>, Dave Jiang
<dave.jiang@...el.com>, Alison Schofield <alison.schofield@...el.com>, Vishal
Verma <vishal.l.verma@...el.com>, Ira Weiny <ira.weiny@...el.com>, Takashi
Sakamoto <o-takashi@...amocchi.jp>, Timur Tabi <timur@...nel.org>, "David S.
Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub
Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH 3/5] cxl/region: Prevent device_find_child() from
modifying caller's match data
On 8/11/24 02:18, Zijun Hu wrote:
> From: Zijun Hu <quic_zijuhu@...cinc.com>
>
> It does not make sense for match_free_decoder() as device_find_child()'s
> match function to modify caller's match data,
match_free_decoder() is just doing that, treating caller's match data as
a piece of memory to store their int.
(So it is hard to tell it does not make sense "for [it] ... to").
> fixed by using
> constify_device_find_child_helper() instead of device_find_child().
I don't like the constify... name, I would go with something like
device_find_child_mut() or similar.
>
> Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
> ---
> drivers/cxl/core/region.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index 21ad5f242875..266231d69dff 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -849,7 +849,8 @@ cxl_region_find_decoder(struct cxl_port *port,
> dev = device_find_child(&port->dev, &cxlr->params,
> match_auto_decoder);
> else
> - dev = device_find_child(&port->dev, &id, match_free_decoder);
> + dev = constify_device_find_child_helper(&port->dev, &id,
> + match_free_decoder);
> if (!dev)
> return NULL;
> /*
>
Powered by blists - more mailing lists