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: <YhIjHjMrhUpM0ucV@smile.fi.intel.com>
Date:   Sun, 20 Feb 2022 13:16:46 +0200
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Bjorn Andersson <bjorn.andersson@...aro.org>
Cc:     Rob Herring <robh+dt@...nel.org>,
        Daniel Scally <djrscally@...il.com>,
        Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
        Sakari Ailus <sakari.ailus@...ux.intel.com>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Hans de Goede <hdegoede@...hat.com>,
        linux-usb@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-acpi@...r.kernel.org,
        Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
Subject: Re: [PATCH v2 1/6] device property: Helper to match multiple
 connections

On Fri, Feb 18, 2022 at 11:00:45AM -0800, Bjorn Andersson wrote:
> On Wed 09 Feb 04:30 PST 2022, Andy Shevchenko wrote:
> > On Mon, Feb 07, 2022 at 07:19:39PM -0800, Bjorn Andersson wrote:

...

> > > +int fwnode_connection_find_matches(struct fwnode_handle *fwnode,
> > > +				   const char *con_id, void *data,
> > > +				   devcon_match_fn_t match,
> > > +				   void **matches, unsigned int matches_len)
> > > +{
> > > +	unsigned int count;
> > > +
> > > +	if (!fwnode || !match || !matches)
> > 
> > !matches case may be still useful to get the count and allocate memory by
> > caller. Please, consider this case.
> > 
> 
> As discussed in previous version, and described in the commit message,
> the returned value of "match" is a opaque pointer to something which
> has to be passed back to the caller in order to be cleaned up.
> 
> E.g. the typec mux code returns a pointer to a typec_mux/switch object
> with a refcounted struct device within, or an ERR_PTR().
> 
> So unfortunately we can must gather the results into matches and pass it
> back to the caller to take consume or clean up.


It's fine. You have **matches, means pointer of an opaque pointer.
What I'm talking about is memory allocation for and array of _pointers_.
That's what caller very much aware of and can allocate on heap. So, please
consider this case.

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ