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


Groups > linux.kernel > #1589269

Re: [PATCH] clk: core: Copy connection id

From "sboyd@codeaurora.org" <sboyd@codeaurora.org>
Newsgroups linux.kernel
Subject Re: [PATCH] clk: core: Copy connection id
Date 2017-02-28 09:20 +0100
Message-ID <tfLaO-1Kw-7@gated-at.bofh.it> (permalink)
References <teuYp-5wX-9@gated-at.bofh.it> <teuYp-5wX-7@gated-at.bofh.it> <teGZz-5LV-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 02/25, Leonard Crestez wrote:
> On Fri, 2017-02-24 at 12:44 -0800, Stephen Boyd wrote:
> > On 02/20, Leonard Crestez wrote:
> > > Some drivers use sprintf to build clk connection id names but the
> > > clk
> > > core will save those strings and occasionally print them back.
> > > Duplicate
> > > the con_id strings instead of fixing all the users.
> > 
> > Good catch. What about dev_id though? That could also have the
> > same problem if some device is removed and we're still holding a
> > reference to the kobject's name. This is probably more rare than
> > what is happening here, but still seems possible that we might
> > trip over that later.
> 
> A device should normally free the clks it uses before it is destroyed.
> This means that if dev_id is pointing to freed memory then the clk
> itself was probably leaked, right?

Sure. clk_get_sys() could be called and then we could have
something sprintf the dev_id there. A quick grep doesn't show any
place where that happens though so it seems safe right now.

That said, it would be nice to clearly document that we don't
expect dev_id to be freed or changed during the lifetime of the
clk structure, but we do allow con_id to change. Perhaps the copy
shows that, but a comment would also be useful so we don't have
people wondering why dev_id isn't copied as well.

> 
> This is obvious misuse of the API, not like sprintf-ing a con_id in a
> complex driver. I don't really think it's worth copying strings for it.
> 

Ok.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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


Thread

Re: [PATCH] clk: core: Copy connection id Stephen Boyd <sboyd@codeaurora.org> - 2017-02-24 21:50 +0100
  Re: [PATCH] clk: core: Copy connection id Leonard Crestez <leonard.crestez@nxp.com> - 2017-02-25 10:40 +0100
    Re: [PATCH] clk: core: Copy connection id "sboyd@codeaurora.org" <sboyd@codeaurora.org> - 2017-02-28 09:20 +0100

csiph-web