mem: fix alignment parameter check
authorDeclan Doherty <declan.doherty@intel.com>
Fri, 16 Jan 2015 15:10:30 +0000 (15:10 +0000)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 19 Jan 2015 08:36:55 +0000 (09:36 +0100)
commit8e3e06501660d09103bdbdff61c55d2f5ffdf433
tree3f4d2793497e3c3e78507914d4e5eaef895c2cd8
parenta30979f6ad7f9745718c9b9f1919f0a2a83627c3
mem: fix alignment parameter check

In commit 2fc8d6d the behaviour of function rte_is_power_of_2 was
changed to not return true for 0. memzone_reserve_aligned_thread_unsafe
and rte_malloc_socket both make the assumption that for align = 0
!rte_is_power_of_2(align) will return false. This patch adds a check
that align parameter is non-zero before doing the power of 2 check.

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
[Thomas: use && operator instead of ternary ?: and fix precedence with parens]
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
lib/librte_eal/common/eal_common_memzone.c
lib/librte_malloc/rte_malloc.c