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

2020-12-16 Thread Andy Shevchenko
On Wed, Dec 16, 2020 at 09:40:30PM +0200, Andy Shevchenko wrote: > On Wed, Dec 16, 2020 at 8:05 PM Andy Shevchenko > wrote: ... > It seems more patches will come. However, this one, since it is a fix, > can be applied disregarding that fact. Therefore please skip the rest > of the series for now

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

2020-12-16 Thread Andy Shevchenko
On Wed, Dec 16, 2020 at 8:05 PM Andy Shevchenko wrote: > > It's realloc() 101 to avoid `foo = realloc(foo, ...);` call > due to getting a memory leak. > > Actually it's not clear why realloc() has been used here. > If we shrink the array, the memcpy() overwrites it anyway > with the contents of a

[PATCH v1 1/4] IOMUX: Preserve console list if realloc() fails

2020-12-16 Thread Andy Shevchenko
It's realloc() 101 to avoid `foo = realloc(foo, ...);` call due to getting a memory leak. Actually it's not clear why realloc() has been used here. If we shrink the array, the memcpy() overwrites it anyway with the contents of a new array. If it becomes bigger, same story. Drop useless realloc()