diff options
author | Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> | 2019-01-14 22:38:16 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-01-16 16:37:00 -0500 |
commit | 0f7c51a676ca73f7950a7e4f9d8454e57324270c (patch) | |
tree | e704b8212a3cede9a80aacd9387dbd812071b214 /common | |
parent | d67f33cf4ee72fd9bc64d68cb51a77798b65cf3a (diff) | |
download | u-boot-0f7c51a676ca73f7950a7e4f9d8454e57324270c.tar.gz u-boot-0f7c51a676ca73f7950a7e4f9d8454e57324270c.tar.bz2 u-boot-0f7c51a676ca73f7950a7e4f9d8454e57324270c.zip |
lib: lmb: reserving overlapping regions should fail
lmb_add_region handles overlapping regions wrong: instead of merging
or rejecting to add a new reserved region that overlaps an existing
one, it just adds the new region.
Since internally the same function is used for lmb_alloc, change
lmb_add_region to reject overlapping regions.
Also, to keep reserved memory correct after 'free', reserved entries
created by allocating memory must not set their size to a multiple
of alignment but to the original size. This ensures the reserved
region is completely removed when the caller calls 'lmb_free', as
this one takes the same size as passed to 'lmb_alloc' etc.
Add test to assert this.
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Diffstat (limited to 'common')
0 files changed, 0 insertions, 0 deletions