Re: [RFC PATCH] kobject: Clean up allocated memory on failure

2019-05-16 Thread Greg Kroah-Hartman
On Thu, May 16, 2019 at 10:01:23PM +1000, Tobin C. Harding wrote: > On Thu, May 16, 2019 at 08:40:29AM +0200, Greg Kroah-Hartman wrote: > > On Thu, May 16, 2019 at 10:07:16AM +1000, Tobin C. Harding wrote: > > > Currently kobject_add_varg() calls kobject_set_name_vargs() then returns > > > the

Re: [RFC PATCH] kobject: Clean up allocated memory on failure

2019-05-16 Thread Tobin C. Harding
On Thu, May 16, 2019 at 08:40:29AM +0200, Greg Kroah-Hartman wrote: > On Thu, May 16, 2019 at 10:07:16AM +1000, Tobin C. Harding wrote: > > Currently kobject_add_varg() calls kobject_set_name_vargs() then returns > > the return value of kobject_add_internal(). kobject_set_name_vargs() > >

Re: [RFC PATCH] kobject: Clean up allocated memory on failure

2019-05-16 Thread Greg Kroah-Hartman
On Thu, May 16, 2019 at 10:07:16AM +1000, Tobin C. Harding wrote: > Currently kobject_add_varg() calls kobject_set_name_vargs() then returns > the return value of kobject_add_internal(). kobject_set_name_vargs() > allocates memory for the name string. When kobject_add_varg() returns > an error

[RFC PATCH] kobject: Clean up allocated memory on failure

2019-05-15 Thread Tobin C. Harding
Currently kobject_add_varg() calls kobject_set_name_vargs() then returns the return value of kobject_add_internal(). kobject_set_name_vargs() allocates memory for the name string. When kobject_add_varg() returns an error we do not know if memory was allocated or not. If we check the return