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: <YiXQ+JChrlcQohx6@smile.fi.intel.com>
Date:   Mon, 7 Mar 2022 11:31:36 +0200
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Bjorn Andersson <bjorn.andersson@...aro.org>
Cc:     Sakari Ailus <sakari.ailus@...ux.intel.com>,
        Rob Herring <robh+dt@...nel.org>,
        Daniel Scally <djrscally@...il.com>,
        Heikki Krogerus <heikki.krogerus@...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 v3 1/6] device property: Helper to match multiple
 connections

On Sun, Mar 06, 2022 at 08:18:24PM -0600, Bjorn Andersson wrote:
> On Fri 04 Mar 07:52 CST 2022, Andy Shevchenko wrote:
> > On Fri, Mar 04, 2022 at 03:41:33PM +0200, Sakari Ailus wrote:

...

> > I have checked vsnprintf() and indeed, it expects to have the size is 0 when
> > the resulting buffer pointer is NULL, and it doesn't do any additional checks.
> 
> Per the vsnprintf() semantics it's not the destination buffer being NULL
> that's significant, but rather just the length being 0 that matters.

Actually the main point is to have buffer to be NULL. But at the same
time size also has to be 0.

When the size is 0, but buffer is not NULL, it's a different story.

> To follow that, I should fill @matches_len entries in @matches and then
> just continue counting without storing anything in @matches.
> 
> But that won't work in this case, because in the event that the @match
> function returns something that has to be freed (such as the refcounted
> objects returned by the typec_mux code), dropping this in favor of just
> counting it would cause memory/reference leaks.
> 
> As such, I think this should differ in that @matches = NULL is
> significant, and it's nice to not have matches_len turn negative/bogus
> in the count case.
> 
> So I like your suggestion.

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ