[U-Boot] [PATCH v4 1/2] dlmalloc: fix malloc range at end of ram

Tom Rini trini at konsulko.com
Wed Apr 24 11:52:57 UTC 2019


On Wed, Apr 24, 2019 at 01:49:52PM +0200, Simon Goldschmidt wrote:
> On Wed, Apr 24, 2019 at 1:27 PM Tom Rini <trini at konsulko.com> wrote:
> >
> > On Tue, Apr 23, 2019 at 09:54:10PM -0600, Simon Glass wrote:
> > > On Mon, 1 Apr 2019 at 14:01, Simon Goldschmidt
> > > <simon.k.r.goldschmidt at gmail.com> wrote:
> > > >
> > > > If the malloc range passed to mem_malloc_init() is at the end of address
> > > > range and 'start + size' overflows to 0, following allocations fail as
> > > > mem_malloc_end is zero (which looks like uninitialized).
> > > >
> > > > Fix this by subtracting 1 of 'start + size' overflows to zero.
> > > >
> > > > Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt at gmail.com>
> > > > ---
> > > >
> > > > Changes in v4: None
> > > > Changes in v3: None
> > > >
> > > >  common/dlmalloc.c | 4 ++++
> > > >  1 file changed, 4 insertions(+)
> > >
> > > Reviewed-by: Simon Glass <sjg at chromium.org>
> >
> > So, the problem with this patch is that it increases the generic malloc
> > code size ever so slightly and blows up smartweb :(
> 
> Ehrm, ok, so how do we proceed?

A good question.  Take a look at spl/u-boot-spl.map on smartweb and see
if, of the malloc functions it doesn't discard there's something that
maybe could be optimized somewhere?

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190424/998a9a69/attachment.sig>


More information about the U-Boot mailing list