From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Joe Perches <joe@perches.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Hans de Goede <hdegoede@redhat.com>,
Wolfram Sang <wsa@the-dreams.de>
Subject: Re: [PATCH v4 3/4] device property: constify property arrays values
Date: Thu, 2 Feb 2017 17:06:07 -0800 [thread overview]
Message-ID: <20170203010607.GB12651@dtor-ws> (raw)
In-Reply-To: <CAJZ5v0jzqfSniR8gzM6yO8Gx2-Av4ia0PYAGodmXqVsoNFvbZg@mail.gmail.com>
On Fri, Feb 03, 2017 at 01:37:25AM +0100, Rafael J. Wysocki wrote:
> On Fri, Feb 3, 2017 at 1:16 AM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> > On Fri, Feb 03, 2017 at 12:16:29AM +0100, Rafael J. Wysocki wrote:
> >> On Thu, Feb 2, 2017 at 7:38 PM, Dmitry Torokhov
> >> <dmitry.torokhov@gmail.com> wrote:
> >> > On Thu, Feb 02, 2017 at 07:52:58PM +0200, Andy Shevchenko wrote:
> >> >> On Thu, 2017-02-02 at 09:07 -0800, Dmitry Torokhov wrote:
> >> >> > On February 2, 2017 8:48:30 AM PST, Andy Shevchenko <andriy.shevchenko
> >> >> > @linux.intel.com> wrote:
> >> >> > > On Thu, 2017-02-02 at 08:39 -0800, Dmitry Torokhov wrote:
> >> >> > > > From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> >> >> > > >
> >> >> > > > Data that is fed into property arrays should not be modified, so
> >> >> > >
> >> >> > > let's
> >> >> > > > mark
> >> >> > > > relevant pointers as const. This will allow us making source
> >> >> > > > arrays
> >> >> > >
> >> >> > > as
> >> >> > > > const/__initconst.
> >> >> > > >
> >> >> > > > Also fix memory leaks on errors in property_entry_copy().
> >> >> > >
> >> >> > > While the code looks okay, I'm not sure what memory leaks you are
> >> >> > > referring to. The idea as far as I remember was to run *free()
> >> >> > > function
> >> >> > > if *copy() fails.
> >> >> >
> >> >> > That could have been OK for internal function, but will not work for
> >> >> > public API, as it goes against normal pattern.
> >>
> >> But it is an internal function, isn't it?
> >>
> >> Also its only caller does the right thing AFAICS.
> >
> > No, actually property_entries_dup() does not do the right thing anymore
> > :(.
>
> Well, it looks like this is because of patch [1/4], so IMO the changes
> to clean up on errors in property_entry_copy() should be made in that
> patch as well.
>
> Right now we seem to have potential memory leaks introduced in patch
> [1/4] and then fixed up in patch [3/4] in the same series which
> doesn't feel quite right to be honest.
Totally agree, I'm reshuffling and will repost the series in a few.
--
Dmitry
next prev parent reply other threads:[~2017-02-03 1:06 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-01 17:31 [PATCH v3 0/4] Export APIs to copy device properties & more Dmitry Torokhov
2017-02-01 17:31 ` [PATCH v3 1/4] device property: export code duplicating array of property entries Dmitry Torokhov
2017-02-01 17:31 ` [PATCH v3 2/4] device property: allow to constify properties Dmitry Torokhov
2017-02-01 17:31 ` [PATCH v3 3/4] driver property: constify property arrays values Dmitry Torokhov
2017-02-01 23:30 ` Joe Perches
2017-02-02 11:24 ` Rafael J. Wysocki
2017-02-02 16:39 ` [PATCH v4 3/4] device " Dmitry Torokhov
2017-02-02 16:48 ` Andy Shevchenko
2017-02-02 17:07 ` Dmitry Torokhov
2017-02-02 17:52 ` Andy Shevchenko
2017-02-02 18:38 ` Dmitry Torokhov
2017-02-02 23:16 ` Rafael J. Wysocki
2017-02-03 0:16 ` Dmitry Torokhov
2017-02-03 0:37 ` Rafael J. Wysocki
2017-02-03 1:06 ` Dmitry Torokhov [this message]
2017-02-02 10:08 ` [PATCH v3 3/4] driver " Mika Westerberg
2017-02-01 17:31 ` [PATCH v3 4/4] i2c: allow specify device properties in i2c_board_info Dmitry Torokhov
2017-02-02 10:08 ` Mika Westerberg
2017-02-01 22:56 ` [PATCH v3 0/4] Export APIs to copy device properties & more Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170203010607.GB12651@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=hdegoede@redhat.com \
--cc=joe@perches.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=rafael.j.wysocki@intel.com \
--cc=rafael@kernel.org \
--cc=rjw@rjwysocki.net \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox