From d1f37e66eb78831db7ad9329465640eb3c08b07c Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Thu, 4 Apr 2019 14:17:36 +0200 Subject: [PATCH] base: fix _sum_in_range in avl structure Handles corner case when addr + size becomes exactly 0. Before the commit the function returned that sum is not part of the range, which is wrong. Issue #3111 --- repos/base/include/base/allocator_avl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repos/base/include/base/allocator_avl.h b/repos/base/include/base/allocator_avl.h index 0716f3bd1c..41cf9df80f 100644 --- a/repos/base/include/base/allocator_avl.h +++ b/repos/base/include/base/allocator_avl.h @@ -48,7 +48,7 @@ class Genode::Allocator_avl_base : public Range_allocator private: static bool _sum_in_range(addr_t addr, addr_t offset) { - return (~0UL - addr > offset); } + return (addr + offset - 1) >= addr; } /* * Noncopyable