kernel: mem_domain: Fix assertion in k_mem_domain_add_partition()

Without the parenthesis, the code was asserting this expression:

    start + (size > start)

Where it should be this instead:

    (start + size) > start

For a quick sanity check when adding these two unsigned values together.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
This commit is contained in:
Leandro Pereira 2018-02-13 17:57:48 -08:00 committed by Anas Nashif
commit 53a7cf9a74

View file

@ -85,8 +85,9 @@ void k_mem_domain_add_partition(struct k_mem_domain *domain,
int p_idx;
unsigned int key;
__ASSERT(domain && part, "");
__ASSERT(part->start + part->size > part->start, "");
__ASSERT(domain != NULL, "");
__ASSERT(part != NULL, "");
__ASSERT((part->start + part->size) > part->start, "");
ensure_w_xor_x(part->attr);