Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1572834

Re: [PATCH v4 3/4] device property: constify property arrays values

From Dmitry Torokhov <dmitry.torokhov@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v4 3/4] device property: constify property arrays values
Date 2017-02-03 02:10 +0100
Message-ID <t6AxY-3aq-7@gated-at.bofh.it> (permalink)
References (5 earlier) <t6tPQ-77C-19@gated-at.bofh.it> <t6uLW-7JC-51@gated-at.bofh.it> <t6yPv-22m-1@gated-at.bofh.it> <t6zLz-2DZ-1@gated-at.bofh.it> <t6A4W-2KU-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/4] Export APIs to copy device properties & more Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-02-01 18:40 +0100
  [PATCH v3 3/4] driver property: constify property arrays values Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-02-01 18:40 +0100
    Re: [PATCH v3 3/4] driver property: constify property arrays values Joe Perches <joe@perches.com> - 2017-02-02 00:40 +0100
      Re: [PATCH v3 3/4] driver property: constify property arrays values "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-02-02 12:30 +0100
        [PATCH v4 3/4] device property: constify property arrays values Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-02-02 17:40 +0100
          Re: [PATCH v4 3/4] device property: constify property arrays values Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-02-02 18:00 +0100
            Re: [PATCH v4 3/4] device property: constify property arrays values Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-02-02 18:10 +0100
              Re: [PATCH v4 3/4] device property: constify property arrays values Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-02-02 19:00 +0100
                Re: [PATCH v4 3/4] device property: constify property arrays values Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-02-02 20:00 +0100
                Re: [PATCH v4 3/4] device property: constify property arrays values "Rafael J. Wysocki" <rafael@kernel.org> - 2017-02-03 00:20 +0100
                Re: [PATCH v4 3/4] device property: constify property arrays values Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-02-03 01:20 +0100
                Re: [PATCH v4 3/4] device property: constify property arrays values "Rafael J. Wysocki" <rafael@kernel.org> - 2017-02-03 01:40 +0100
                Re: [PATCH v4 3/4] device property: constify property arrays values Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-02-03 02:10 +0100
    Re: [PATCH v3 3/4] driver property: constify property arrays values Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-02-02 11:10 +0100
  [PATCH v3 2/4] device property: allow to constify properties Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-02-01 18:40 +0100
  Re: [PATCH v3 0/4] Export APIs to copy device properties & more Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-02-02 00:00 +0100

csiph-web