From: Bruce Richardson Date: Fri, 29 May 2015 14:34:15 +0000 (+0100) Subject: i40e: fix build with gcc 5.1 X-Git-Tag: spdx-start~9145 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=36501efdfc3151567bedc408a05e4bb818082400;p=dpdk.git i40e: fix build with gcc 5.1 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 Acked-by: Neil Horman --- diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index e688b4f51e..4bf98d0f99 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -551,7 +551,7 @@ i40e_set_flx_pld_cfg(struct i40e_pf *pf, memset(flex_pit, 0, sizeof(flex_pit)); num = i40e_srcoff_to_flx_pit(cfg->src_offset, flex_pit); - for (i = 0; i < num; i++) { + for (i = 0; i < RTE_MIN(num, RTE_DIM(flex_pit)); i++) { field_idx = layer_idx * I40E_MAX_FLXPLD_FIED + i; /* record the info in fdir structure */ pf->fdir.flex_set[field_idx].src_offset =