Re: [PATCH v2 4/7] IOMUX: Preserve console list if realloc() fails

2020-12-21 Thread Simon Glass
Hi Andy, On Mon, 21 Dec 2020 at 10:16, Andy Shevchenko wrote: > > On Mon, Dec 21, 2020 at 09:47:03AM -0700, Simon Glass wrote: > > On Mon, 21 Dec 2020 at 05:00, Andy Shevchenko > > wrote: > > > On Fri, Dec 18, 2020 at 07:29:19PM -0700, Simon Glass wrote: > > > > On Wed, 16 Dec 2020 at 16:16, And

Re: [PATCH v2 4/7] IOMUX: Preserve console list if realloc() fails

2020-12-21 Thread Andy Shevchenko
On Mon, Dec 21, 2020 at 09:47:03AM -0700, Simon Glass wrote: > On Mon, 21 Dec 2020 at 05:00, Andy Shevchenko > wrote: > > On Fri, Dec 18, 2020 at 07:29:19PM -0700, Simon Glass wrote: > > > On Wed, 16 Dec 2020 at 16:16, Andy Shevchenko > > > wrote: > > > > > > > > It's realloc() 101 to avoid `foo

Re: [PATCH v2 4/7] IOMUX: Preserve console list if realloc() fails

2020-12-21 Thread Simon Glass
Hi Andy, On Mon, 21 Dec 2020 at 05:00, Andy Shevchenko wrote: > > On Fri, Dec 18, 2020 at 07:29:19PM -0700, Simon Glass wrote: > > On Wed, 16 Dec 2020 at 16:16, Andy Shevchenko > > wrote: > > > > > > It's realloc() 101 to avoid `foo = realloc(foo, ...);` call > > > due to getting a memory leak.

Re: [PATCH v2 4/7] IOMUX: Preserve console list if realloc() fails

2020-12-21 Thread Andy Shevchenko
On Fri, Dec 18, 2020 at 07:29:19PM -0700, Simon Glass wrote: > On Wed, 16 Dec 2020 at 16:16, Andy Shevchenko > wrote: > > > > It's realloc() 101 to avoid `foo = realloc(foo, ...);` call > > due to getting a memory leak. > > Hmm I don't think I knew that... When you use the same variable for the

Re: [PATCH v2 4/7] IOMUX: Preserve console list if realloc() fails

2020-12-18 Thread Simon Glass
On Wed, 16 Dec 2020 at 16:16, Andy Shevchenko wrote: > > It's realloc() 101 to avoid `foo = realloc(foo, ...);` call > due to getting a memory leak. Hmm I don't think I knew that... > > Actually it's not clear why realloc() has been used here. > If we shrink the array, the memcpy() overwrites it