mem: fix possible integer overflow
authorSergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Tue, 14 Jun 2016 18:07:18 +0000 (19:07 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 20 Jun 2016 08:54:57 +0000 (10:54 +0200)
commitd4ee3c61c06ceea054d269a44540e0db054a6db0
treedbcfbfdf37b18454120e91f83242e6297ac83016
parent3f0339efc1ffa171ddcea94ed4c5c113635d5545
mem: fix possible integer overflow

It is possible to get an integer overflow if we try to reserve a memzone
with len = 0 (meaning the maximum contiguous space available) and the
maximum available elem size is less than (MALLOC_ELEM_OVERHEAD + align).

Coverity issue: 107111

Fixes: fafcc11985a2 ("mem: rework memzone to be allocated by malloc")

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
lib/librte_eal/common/eal_common_memzone.c