From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58]) by dpdk.org (Postfix) with ESMTP id 0B9BC5A57 for ; Fri, 29 May 2015 16:08:15 +0200 (CEST) Received: from hmsreliant.think-freely.org ([2001:470:8:a08:7aac:c0ff:fec2:933b] helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1YyKx9-0004wU-JT; Fri, 29 May 2015 10:08:13 -0400 Date: Fri, 29 May 2015 10:07:57 -0400 From: Neil Horman To: Bruce Richardson Message-ID: <20150529140757.GB29575@hmsreliant.think-freely.org> References: <1432904027-6578-1-git-send-email-bruce.richardson@intel.com> <1432904027-6578-2-git-send-email-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1432904027-6578-2-git-send-email-bruce.richardson@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Score: -2.9 (--) X-Spam-Status: No Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH 1/4] eal: fix compile on Fedora 22 (GCC 5.1) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 May 2015 14:08:15 -0000 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 > --- > 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 > >