Re: [PATCH] perf/core: use strndup_user() instead of buggy open-coded version

2019-02-20 Thread Masami Hiramatsu
Hi Jann, On Wed, 20 Feb 2019 16:19:10 +0100 Jann Horn wrote: > On Tue, Feb 19, 2019 at 3:51 PM Masami Hiramatsu wrote: > > On Tue, 19 Feb 2019 20:45:02 +0900 > > Masami Hiramatsu wrote: > > > > > On Mon, 18 Feb 2019 23:07:23 +0100 > > > Jann Horn wrote: > > > > > > > The first version of this

Re: [PATCH] perf/core: use strndup_user() instead of buggy open-coded version

2019-02-20 Thread Jann Horn
On Tue, Feb 19, 2019 at 3:51 PM Masami Hiramatsu wrote: > On Tue, 19 Feb 2019 20:45:02 +0900 > Masami Hiramatsu wrote: > > > On Mon, 18 Feb 2019 23:07:23 +0100 > > Jann Horn wrote: > > > > > The first version of this method was missing the check for > > > `ret == PATH_MAX`; then such a check was

Re: [PATCH] perf/core: use strndup_user() instead of buggy open-coded version

2019-02-19 Thread Masami Hiramatsu
On Tue, 19 Feb 2019 20:45:02 +0900 Masami Hiramatsu wrote: > On Mon, 18 Feb 2019 23:07:23 +0100 > Jann Horn wrote: > > > The first version of this method was missing the check for > > `ret == PATH_MAX`; then such a check was added, but it didn't call kfree() > > on error, so there was still a s

Re: [PATCH] perf/core: use strndup_user() instead of buggy open-coded version

2019-02-19 Thread Masami Hiramatsu
On Mon, 18 Feb 2019 23:07:23 +0100 Jann Horn wrote: > The first version of this method was missing the check for > `ret == PATH_MAX`; then such a check was added, but it didn't call kfree() > on error, so there was still a small memory leak in the error case. > Fix it by using strndup_user() inst

[PATCH] perf/core: use strndup_user() instead of buggy open-coded version

2019-02-18 Thread Jann Horn
The first version of this method was missing the check for `ret == PATH_MAX`; then such a check was added, but it didn't call kfree() on error, so there was still a small memory leak in the error case. Fix it by using strndup_user() instead of open-coding it. Fixes: 0eadcc7a7bc0 ("perf/core: Fix p