diff options
author | Andrew Yourtchenko <ayourtch@gmail.com> | 2018-09-19 15:50:55 +0200 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2018-09-19 19:21:45 +0000 |
commit | a713254d689deee1718bb515c3961bf4ed435504 (patch) | |
tree | 49dab1298704329bb4d55f3324d9dc419ef5a46c /src/vppinfra/bihash_template.c | |
parent | 2646c80db8d3d1a3cd7555328d5a0038798f861e (diff) |
bihash template: reinstate the check for the available memory in the arena
ffb14b9554afa1e58c3657e0c91dda3135008274 has changed the semantics
of alloc_arena_next to become an offset off alloc_arena, but
in the available memory check in BV (alloc_aligned) it still treats
it as a virtual address, resulting in the check always succeeding,
thus over a prolonged period bihash arena allocator
potentially overwriting whatever is following the arena.
Change-Id: I18882c5f340ca767a389e15cca2696a0a97ef015
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Diffstat (limited to 'src/vppinfra/bihash_template.c')
-rw-r--r-- | src/vppinfra/bihash_template.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/vppinfra/bihash_template.c b/src/vppinfra/bihash_template.c index 882f81cc14b..2571c47e64c 100644 --- a/src/vppinfra/bihash_template.c +++ b/src/vppinfra/bihash_template.c @@ -26,7 +26,7 @@ static inline void *BV (alloc_aligned) (BVT (clib_bihash) * h, uword nbytes) rv = alloc_arena_next (h); alloc_arena_next (h) += nbytes; - if (rv >= (alloc_arena (h) + alloc_arena_size (h))) + if (rv >= alloc_arena_size (h)) os_out_of_memory (); return (void *) (uword) (rv + alloc_arena (h)); |