mem: fix build with -O1
authorOlivier Matz <olivier.matz@6wind.com>
Mon, 19 Sep 2016 12:26:51 +0000 (14:26 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 6 Oct 2016 13:23:53 +0000 (15:23 +0200)
commit11fd19f7646743c973b9de52d75120045e62f116
treeec69d70be3ffb1a3d1fe49ff4b8dddf6ea5d4694
parent595f3022968641a5ef0a0dbb4473a1837796020a
mem: fix build with -O1

When compiled with EXTRA_CFLAGS="-O1", the compiler is not
able to detect that size is always initialized when used, and
issues a wrong warning:

  eal_memory.c: In function ‘rte_eal_hugepage_attach’:
  eal_memory.c:1684:3: error: ‘size’ may be used uninitialized in this
                       function [-Werror=maybe-uninitialized]
     munmap(hp, size);
     ^

Workaround this issue by initializing size to 0.
Seen on gcc (Debian 5.4.1-1) 5.4.1 20160803.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
lib/librte_eal/linuxapp/eal/eal_memory.c