On Fri, May 29, 2015 at 01:53:44PM +0100, Bruce Richardson wrote: > On Fedora 22, with GCC 5.1, errors are reported due to array accesses > being potentially out of bounds. This commit fixes this by adding in an > extra bounds check to the loop counter. > > Signed-off-by: Bruce Richardson <bruce.richardson at intel.com> > --- > lib/librte_eal/linuxapp/eal/eal_memory.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c > b/lib/librte_eal/linuxapp/eal/eal_memory.c > index 5f9f92e..744635f 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_memory.c > +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c > @@ -1188,7 +1188,8 @@ rte_eal_hugepage_init(void) > int socket = tmp_hp[i].socket_id; > > /* find a hugepage info with right size and increment num_pages > */ > - for (j = 0; j < (int) internal_config.num_hugepage_sizes; j++) { > + for (j = 0; j < (int) internal_config.num_hugepage_sizes && > + j < MAX_HUGEPAGE_SIZES; j++) { > if (tmp_hp[i].size == Use RTE_MIN here, it will look alot cleaner I think Neil
> > internal_config.hugepage_info[j].hugepage_sz) { > #ifdef RTE_EAL_SINGLE_FILE_SEGMENTS > -- > 2.4.1 > >